...
Failing to use the correct syntax when declaring a flexible array member can result in undefined behavior, although the incorrect syntax will work on most implementations.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL38-C | Low | Unlikely | Low | P3 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||
---|---|---|---|---|---|---|---|
Astrée |
|
Supported, but no explicit checker | |
Compass/ROSE |
Can detect some violations of this rule. In particular, it warns if the last element of a | |||||||||
LDRA tool suite |
| 648 S | Fully implemented | ||||||
Parasoft C/C++test |
| CERT_C-DCL38-a | The final member of a structure should not be an array of size '0' or '1' | ||||||
PRQA QA-C |
| 1037 1039 |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
This rule supplements MEM33-C. Allocate and copy structures containing a flexible array member dynamically
Bibliography
[ISO/IEC 9899:2011] | 6.5.6, "Additive Operators" 6.7.2.1, "Structure and Union Specifiers" |
[McCluskey 2001] | "Flexible Array Members and Designators in C9X" |
...