Maybe is a silly question but I can't understand exactly why this type of buffer overflow does not work...
Let's me explain with an example.
Suppose we have a program written in c. This program has 2 function , normal() and special(). In main function we have a pointer which points in address of normal function. Also it has an array we 5 bytes which we fill using gets and after that we Call the pointer which has the address of normal () . Our goal is to perform buffer overflow which overwrite the content of the pointer with the address of function special.
So when I write a python script like python-c " A*5 + <address_of_special> " | myprogram I successfully perform an buffer overflow calling the special function.
However, when I try to run the program without the script, for example ./myprogram AAAAA + address_of_special I get segmentation fault and the program crash.
Why this happens ; I mean the program gets the same input but I have different results ...