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 recommendation STR05-C. Use pointers to const when referring to string literals and rule 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 recommendation EXP05-C. Do not cast away a const qualification.

...

Tool

Version

Checker

Description

Section

Compass/ROSE

 

 

Section

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

...

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

Related Guidelines

CERT C++ Secure Coding Standard: 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]\] TR 24772 "CSJ Passing parameters and return values"

Bibliography

...

      02. Declarations and Initialization (DCL)