Versions Compared

Key

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

...

EXP05-EX2: A number of C99 standard library functions are specified to return non-const pointers that refer to their const-qualified arguments. When the actual arguments to such functions reference const objects, attempting to use the returned non-const pointers to modify the const objects would be a violation of guideline rule EXP40-C. Do not modify constant values and lead to undefined behavior. These functions are the following:

...

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

Related Guidelines

CERT C++ Secure Coding Standard: EXP35-CPP. Do not cast away a const qualification

Bibliography

Wiki Markup\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 6.7.3, "Type qualifiers"

\[[ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] "HFC Pointer casting and pointer type changes" and "IHN Type system" \[[MISRA 2004|AA. Bibliography#MISRA 04]\] Rule

MISRA Rule 11.5 \[[MITRE 2007|AA. Bibliography#MITRE 07]\] [CWE ID 704|http://cwe.mitre.org/data/definitions/704.html], "Incorrect Type Conversion or Cast"

MITRE CWE: CWE-704, "Incorrect Type Conversion or Cast"

Bibliography

...

EXP04-C. Do not perform byte-by-byte comparisons involving a structure      03. Expressions (EXP)      EXP06-C. Operands to the sizeof operator should not contain side effects