...
- The incomplete array type must be the last element within the structure.
- There cannot be an array of structures that contain a flexible array member.
- Structures that contain a flexible array member cannot be used as a member of another structure.
- The structure must contain at least one named member in addition to the flexible array member.
MEM33-C. Allocate and copy structures containing a flexible array member dynamically describes how to allocate and copy structures containing flexible array members.
Noncompliant Code Example
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
...
This rule supplements MEM33-C. Allocate and copy structures containing a flexible array
...
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" |
...