Following this: How can I exploit a buffer overflow?
I have a code compiled using -fno-stack-protector
:
#include <stdio.h>
void shellcode(){
printf("\n Reached shellcode!");
}
int main(int argc, char **argv){
char buf[3];
sprintf(buf, "%s", argv[1]);
return 0;
}
but unable to execute the shellcode
function.
Like in that post i am using:
python -c 'print "A"*27+"\x49\x11\x00\x00\x00\x00\x00\x00"' > input
./a < input
Get a segfault at:
./a 12345678901
Segmentation fault (core dumped)
but nothing happens.
my main goal is to execute ls
on linux os instead of shellcode
function. but right now nothing works.