Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the second strcat_nc() call, the compiler compiles the code with no warnings, but the resulting code will attempt to modify the "str1" literal. This violates guidelines STR05-C. Use pointers to const when referring to string literals and STR30-C. Do not attempt to modify string literals.

...

Not declaring an unchanging value const prohibits the function from working with values already cast as const. This problem can be sidestepped by type casting away the const, but doing so violates guideline EXP05-C. Do not cast away a const qualification.

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

DCL13-C

low

unlikely

low

P3

L3

Automated Detection

Tool

Version

Checker

Description

Section

Compass/ROSE

 

 

Section

can detect violations of this recommendation while checking for violations of guideline DCL00-C. Const-qualify immutable objects

...

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Other Languages

Related Guidelines

This rule appears in the C++ Secure Coding Standard as : DCL13-CPP. Declare function parameters that are pointers to values not changed by the function as const.

Bibliography

Wiki Markup
\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] 
\[[ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] "CSJ Passing parameters and return values"

...