What causes buffer overflow to generate ?
... When you overflow a buffer. A buffer is like a temporary container which you write data to, while the data is being prepared to be written elsewhere. Say for example, you have a buffer of 100 bytes: char buffer; if you happen to write more than 100 bytes worth of characters into this buffer, overflow happens. You begin writing beyond the boundaries of the buffer into memory slots that were not allocated to you. If the memory access violation does not crash your program or system, it will (in an even worse scenario) quietly corrupt memory which belongs to other processes and cause unexpected results.
What Fermi said. Best explanation of buffer overrun I have ever seen and I have been programming since the mid-70's.