Do not cast away a const qualification on an object of pointer type. Casting away the const qualification allows a program to modify the object referred to by the pointer, which may result in undefined behavior. See undefined behavior 64 in Appendix J of the C standard [ISO/IEC 9899:2011].
...
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| 203 S | Fully implemented. | |||||||
GCC |
|
| Can detect violations of this recommendation when the | ||||||
Compass/ROSE |
|
|
| ||||||
| castexpr | Fully implemented. | |||||||
| PRQA QA-C |
| 0311 | Fully implemented |
Related Vulnerabilities
...
ISO/IEC 9899:2011 Section 6.7.3, "Type qualifiers"
ISO/IEC PDTR 24772 "HFC Pointer casting and pointer type changes" and "IHN Type system"
MISRA Rule 11.5
MITRE CWE: CWE-704, "Incorrect type conversion or cast"
...