Make sure the overflow occurs inside a function and not inside main, as demonstrated in the code below. This will ensure that the overflow occurs on the stack which allows the return address fed to EIP when the function exits to be overwritten.
A buffer of 28 A characters will overwrite EIP for the code below.
Code:#include <stdio.h> #include <string.h> #include <stdlib.h> void function(char *input) { char buffer[20]; strcpy(buffer, input); //overflow here, when function returns to main the return address can be overwritten } int main(int argc, char *argv[]) { function(argv[1]); return 0; }


