A buffer is defined as a limited, contiguously allocated set of memory. The most common buffer in C is an array.
When a program is loaded into memory, it is organized into three areas of memory, called segments: the text segment, stack segment, and heap segment. The text segment is static while the stack and heap are dynamic, that is, stack and heap can increase the length of themselves during the executing. Therefore, it is probably cause buffer overflow in stack and heap. Buffer overflow is an anomalous condition where a process attempts to store more data in a buffer
than there is memory allocated for it, causing the extra data to overwrite adjacent memory locations.
This document is in PDF format. To view it click here.