...
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 | ||||
---|---|---|---|---|
| ||||
if (puts("foo") == EOF) { /* Handle error */ } |
...
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...