Buffer Overflow Causes. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle.  http://sfsecurity.pr.erau.edu
Careless use of buffers without bounds checking - Recommendations.
Before you copy to, format, or send input to a buffer make sure it is big enough to hold whatever might be thrown at it.
Testing should catch most of this kind of buffer overflows.  If there is a buffer overflow, the software should crash or data should get corrupted if a very long string is given for input.