CWE-464
Weakness AllowedAddition of Data Structure Sentinel
Abstraction: Base · Status: Incomplete
The accidental addition of a data-structure sentinel can cause serious programming logic problems.
Data-structure sentinels are often used to mark the structure of data. A common example of this is the null character at the end of strings or a special sentinel to mark the end of a linked list. It is dangerous to allow this type of control data to be easily accessible. Therefore, it is important to protect from the addition or modification of sentinels.
Dimensions
- Behavior-Type: Addition
- Code-Type: Data Structure Sentinel
Mapping guidance
This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.
Modes of introduction
Content history
Reported compilation error with demonstrative example.
updated Time_of_Introduction
updated Applicable_Platforms, Common_Consequences, Relationships, Other_Notes, Taxonomy_Mappings
updated Relationships, Taxonomy_Mappings
updated Demonstrative_Examples, Description, Other_Notes, Potential_Mitigations, Relationships
updated Common_Consequences
updated Common_Consequences
updated Relationships, Taxonomy_Mappings
updated Relationships
updated Potential_Mitigations
updated Relationships
updated Demonstrative_Examples, Likelihood_of_Exploit, Taxonomy_Mappings
updated References, Relationships
updated Relationships, Time_of_Introduction
updated Mapping_Notes
updated Demonstrative_Examples
updated Demonstrative_Examples, Weakness_Ordinalities
updated Dimensions
0 vulnerabilities reference this CWE, most recent first.
No vulnerabilities reference this CWE.
Mitigation
Encapsulate the user from interacting with data sentinels. Validate user input to verify that sentinels are not present.
Mitigation
Proper error checking can reduce the risk of inadvertently introducing sentinel values into data. For example, if a parsing function fails or encounters an error, it might return a value that is the same as the sentinel.
Mitigation
Use an abstraction library to abstract away risky APIs. This is not a complete solution.
Mitigation
Use OS-level preventative functionality. This is not a complete solution.
No CAPEC attack patterns related to this CWE.