Out-of-bounds Write |
Weakness ID: 787 (Weakness Base) | Status: Incomplete |
Description Summary
The software writes data past the end, or before the beginning, of the intended buffer.
Extended Description
This typically occurs when the pointer or its index is incremented or decremented to a position beyond the bounds of the buffer or when pointer arithmetic results in a position outside of the valid memory location to name a few. This may result in corruption of sensitive information, a crash, or code execution among other things.
Example 1
The following code attempts to save four different identification numbers into an array.
(Bad Code)
Example Language: C
int id_sequence[3];
/* Populate the id array. */
id_sequence[0] = 123;
id_sequence[1] = 234;
id_sequence[2] = 345;
id_sequence[3] = 456;
Nature | Type | ID | Name | View(s) this relationship pertains to |
---|---|---|---|---|
ChildOf | Weakness Class | 119 | Failure to Constrain Operations within the Bounds of a Memory Buffer | Development Concepts (primary)699 Research Concepts (primary)1000 |
ParentOf | Weakness Variant | 121 | Stack-based Buffer Overflow | Development Concepts699 Research Concepts1000 |
ParentOf | Weakness Variant | 122 | Heap-based Buffer Overflow | Development Concepts699 Research Concepts1000 |
ParentOf | Weakness Base | 124 | Buffer Underwrite ('Buffer Underflow') | Development Concepts699 Research Concepts1000 |