Functions that manipulate strings encourage buffer overflows.
Applicable Platforms
Languages
C
C++
Demonstrative Examples
Example 1
Windows provides the _mbs family of functions to perform various
operations on multibyte strings. When these functions are passed a malformed
multibyte string, such as a string containing a valid leading byte followed
by a single null byte, they can read or write past the end of the string
buffer causing a buffer overflow. The following functions all pose a risk of
buffer overflow: _mbsinc _mbsdec _mbsncat _mbsncpy _mbsnextc _mbsnset
_mbsrev _mbsset _mbsstr _mbstok _mbccpy _mbslen