...
Noncompliant Code Example (Narrow String Literal)
In the following this noncompliant code example, the const
keyword has been omitted:
...
If a statement such as c[0] = 'C'
were placed following the declaration in the noncompliant code example, the code is likely to compile cleanly, but the result of the assignment would be undefined be undefined because string literals are considered constant.
...
Noncompliant Code Example (Wide String Literal)
In the following this noncompliant code example, the const
keyword has been omitted:
...
If a statement such as c[0] = L'C'
were placed following this declaration, the code is likely to compile cleanly, but the result of the assignment would be undefined because be undefined because string literals are considered constant.
...
Modifying string literals causes undefined behavior, resulting in abnormal program termination and denial-of-service vulnerabilities.
...
Related Vulnerabilities
Search for for vulnerabilities resulting from the violation of this rule on the CERT website.
...