quarta-feira, 9 de dezembro de 2009

It's funny how the things works when you know why they works ! (: Or have a little idea

retaddr.asm
segment .text
 global retaddr
retaddr:
 enter 0,0
 lea  eax, [ebp + 8]

 leave
 ret

fakeint.c
#include <stdio.h>

int *retaddr (int);

int 
main (void)
{
 printf ("%s\n", * retaddr ("Hello World")); 
 return 0;
}

Compiling:
nasm -f elf retaddr.asm
gcc -o fake fake.c retaddr.o
        This will raise some warnings ... but
         at least here works (:

Nenhum comentário:

Postar um comentário