Glossary:Buffer overflow vulnerability
A buffer overflow happens when a program is given more data (whether direct user input or from a network source) than will fit in the memory space that has been allocated for it. The extra may then overwrite nearby data causing unexpected behaviour, which may include an attacker being able to take over control of the program. Buffer overflows can be avoided by strict adherence to a cardinal rule of secure coding: thoroughly validate all input from potentially untrusted sources.