...
Another common mistake is to use more format specifiers than supplied arguments. This results in undefined behavior, which could end up pulling extra values off the stack and unintentionally exposing data. The following example illustrates a case of this:
Code Block | ||
---|---|---|
| ||
char const char *error_msg = "Resource not available to user."; /* ... */ printf("Error (%s): %s", error_msg); |
...
The following code matches the number of format specifiers with the number of variable arguments.
Code Block | ||
---|---|---|
| ||
char const char *error_msg = "Resource not available to user."; /* ... */ printf("Error: %s", error_msg); |
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL10-A | 2 ( medium ) 2 ( | probable ) | 2 ( medium ) | P8 | L2 |
Related Vulnerabilities
...