...
This compliant solution uses the identifier assigned to the constant value in the expression.:
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> /* ... */ nblocks = 1 + (nbytes - 1) / BUFSIZ; |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
CERT C++ Secure Coding Standard | EXP07-CPP. Do not diminish the benefits of constants by assuming their values in expressions |
Bibliography
[Plum 1985] | Rule 1-5 |
...