Make the cut 4 1 0 serial port

broken image

It waits until the complete value is captured.It ensures the string value is always null terminated (even when buffer size is completely filled).For example, if the source had an error and generated input without the expected terminator or was malicious. It detects unusually long input values and safely discards them.Here is a more robust implementation that handles abnormal input and race conditions.