Versions Compared

Key

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

...

This recommendation encompasses void MEM32-C. Detect and handle memory allocation errors, VOID FIO04-C. Detect and handle input and output errors, and void FIO34-C. Use int to capture the return value of character IO functions that might be used to check for end of file.

Noncompliant Code Example

...

This compliant solution checks to make sure no output error occurred. (See VOID FIO04-C. Detect and handle input and output errors.)

Code Block
bgColor#ccccff
langc
if (puts("foo") == EOF) {
  /* Handle error */
}

...

Related Vulnerabilities

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

...