In a software program, buffer overflow occurs when a program, while writing data to a buffer, overruns the buffer size allocated and starts overwriting data to adjacent memory locations.
A buffer can be considered a temporary area in the memory allocated to a program to store and retrieve data when needed.
Buffer overflows have been known to be exploited since long back.
When exploiting buffer overflows, our main focus is on overwriting some control information so that the flow of control of the program changes, which will allow our code to take control of the program.
Here is a diagram that will give us a basic idea of an overflow happening in a buffer:
From the preceding diagram, we can assume this is what a program looks ...