...
This non-compliant code example is intended to be used to remove the trailing newline (\n) from an input line.
| Code Block | ||
|---|---|---|
| ||
char buf[1024]; fgets(buf, sizeof(buf), fp); buf[strlen(buf) - 1] = '\0'; |
...
| Code Block | ||
|---|---|---|
| ||
char buf[1024];
if (fgets(buf, sizeof(buf), fp))
{
char *p;
if (p=strchr(buf, '\n'))
*p = 0;
}
|
Priority and Level
Risk Assessment
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
EXP01-A | |||||
Component | Value | ||||
Severity | 1 (low) | Likelihood | 1 (unlikely) | 3 1 (low) | |
Remediation cost | 2 (medium) | ||||
Priority | P2 | Level | L3 |||
P3 | P3 |
References
- Lai 06
- Seacord 05 Chapter 2 Strings
- ISO/IEC 9899-1999 Section 7.19.7.2 The fgets function