In simple words, a buffer is a place to store any kind of data. An overflow occurs when the data in the buffer exceeds the size of the buffer itself. An attacker can then perform an overflow attack so as to get control of the program and execute malicious payloads.
Let's use an example of a simple program and see how we could exploit it. In the following screenshot, we have a simple program with three functions:
main. The following is the program we are trying to exploit:
ShouldNotBeCalled function is never called during the entire runtime of the program.
vulnerable function ...