CWE-588

Attempt to Access Child of a Non-structure Pointer
AI Translation Available

Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption.

Status
incomplete
Abstraction
variant
C C++

Common Consequences

integrity availability
Impacts
modify memory dos: crash, exit, or restart

Detection Methods

automated static analysis

Potential Mitigations

Phases:
requirements implementation
Descriptions:
• Review of type casting operations can identify locations where incompatible types are cast.
• The choice could be made to use a language that is not susceptible to these issues.