...
In this noncompliant code example, more than one character is pushed back on the stream referenced by fp.:
| Code Block | ||||
|---|---|---|---|---|
| ||||
FILE *fp;
char *file_name;
/* Initialize file_name */
fp = fopen(file_name, "rb");
if (fp == NULL) {
/* Handle error */
}
/* Read data */
if (ungetc('\n', fp) == EOF) {
/* Handle error */
}
if (ungetc('\r', fp) == EOF) {
/* Handle error */
}
/* Continue on */
|
...
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
Compass/ROSE |
|
| Can detect simple violations of this recommendation. In particular, it warns when two calls to | ||||||
| 83 D | Fully implemented. |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
| [ISO/IEC 9899:2011] | Section 7.21.7.10, "The ungetc Function" |
...