Bounds-checking functions
One of the serious problems with C programs operating on strings and byte arrays is the ability to go easily beyond the boundary defined for a buffer or a byte array.
As a reminder, a buffer is a region of memory that is used as the place holder for a byte array or a string variable. Going beyond the boundary of a buffer causes a buffer overflow and based on that a malicious entity can organize an attack (usually called a buffer overflow attack). This type of attack either results in a denial of service (DOS) or in exploitation of the victim C program.
Most such attacks usually start in a function operating on character or byte arrays. String manipulation functions found in string.h
, such as strcpy
and strcat
, are among the vulnerable functions that lack a boundary checking mechanism to prevent buffer overflow attacks.
However, as part of C11, a new set of functions has been introduced. Bounds-checking functions borrow the same name from the...