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.

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Other Languages

Related Guidelines

CERT This rule appears in the C++ Secure Coding Standard as : FIO36-CPP. Do not assume a new-line character is read when using fgets().

Bibliography

unmigrated-wiki-markup

\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 7.19.7.2, "The {{fgets}} function"

Bibliography

Wiki Markup

\[[Lai 062006|AA. Bibliography#Lai 06]\]
\[[Seacord 05a205a|AA. Bibliography#Seacord 05]\] Chapter 2, "Strings"

...