1107
Example Language: C (Bad)
char *foo;
int counter;
foo=calloc(sizeof(char)*10);
for (counter=0;counter!=10;counter++) {
foo[counter]='a';
printf("%s\n",foo);
}
The string foo has space for 9 characters and a null terminator, but 10 characters are written to it.
As a result, the string foo is not null terminated and calling printf() on it will have unpredictable and
possibly dangerous results.
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 977 SFP Secondary Cluster: Design 888 2407
MemberOf 1407 Comprehensive Categorization: Improper Neutralization 1400 2532
Taxonomy Mappings
Mapped Taxonomy Name Node ID Fit Mapped Node Name
CLASP Deletion of data-structure sentinel
References
[REF-18]Secure Software, Inc.. "The CLASP Application Security Process". 2005. < https://
cwe.mitre.org/documents/sources/TheCLASPApplicationSecurityProcess.pdf >.
[REF-62]Mark Dowd, John McDonald and Justin Schuh. "The Art of Software Security
Assessment". 1st Edition. 2006. Addison Wesley.
CWE-464: Addition of Data Structure Sentinel
Weakness ID : 464
Structure : Simple
Abstraction : Base
Description
The accidental addition of a data-structure sentinel can cause serious programming logic problems.
Extended Description
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.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 138 Improper Neutralization of Special Elements 373
CWE Version 4.14
CWE-464: Addition of Data Structure Sentinel
CWE-464: Addition of Data Structure Sentinel