Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An obvious alternative is to leave room in the buffer for one more character, and when no new-line is transferred, append a new-line followed by a null-termination character. This approach is unsafe, because it quietly accepts an input that is not what was actually intended, with unknown consequences.

Risk Assessment

Assuming Incorrectly assuming a new-line character is read by fgets() or fgetws() can result in data truncation.

...