Out-of-Bounds Access¶
Rule ID¶
MI107
Definition¶
The software accesses data past the end, or before the beginning, of the intended buffer.
Example¶
See one of the applicable code examples from CWE.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
This example takes an IP address from a user, verifies that it is well formed and then looks up the hostname and copies it into a buffer. This function allocates a buffer of 64 bytes to store the hostname, however there is no guarantee that the hostname will not be larger than 64 bytes. If an attacker specifies an address which resolves to a very large hostname, then the function may overwrite sensitive data or even relinquish control flow to the attacker.