...
If a function modifies a pointed-to value, declaring this value as const will be caught by the compiler.
| Code Block | ||
|---|---|---|
| ||
void foo(const int * x) {
if (x != NULL) {
*x = 3; /* generates compiler warning */
}
/* ... */
}
|
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
EXP10 DCL13-A | medium | unlikely | high | P2 | L3 |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
References
| Wiki Markup |
|---|
\[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] \[[ISO/IEC PDTR 24772|AA. C References#ISO/IEC PDTR 24772]\] "CSJ Passing parameters and return values" |
...
EXP09DCL12-A. Use sizeof to determine the size of a type or variable 03. Expressions (EXP) EXP30-C. Do not depend on order of evaluation between sequence pointsCreate and use abstract data types 02. Declarations and Initialization (DCL)