Versions Compared

Key

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

It is possible to assign modify the value of a constant object by using a non-constant value, but the resulting behavior is undefined. According to C99 Section 6.7.3, "Type qualifiers," Paragraph 5:

...

The compliant solution depends on the intention of the programmer. If the intention is that the value of c is modifiable, then it should not be declared as a constant. If the intention is that the value of c is not meant to change, then do not write non-compliant code that attempts to modify it.

Risk Assessment

Integer truncation errors can lead to buffer overflows and the execution of arbitrary code by an attackerModifying constant values through non-constant references results may result in unexpected program behavior.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

EXP31-C

1 (low)

1 (unlikely)

2 (medium)

P2

L3

...

Wiki Markup
\[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] Section 6.7.3, "Type qualifiers," and Section 6.5.16.1, "Simple assignment"

...