Created
May 12, 2010 16:52
-
-
Save slembcke/398816 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void func2(int a, int b, int c, int d, int e){ | |
printf("%d %d %d %d %d\n", a, b, c, d, e); | |
} | |
void func1(int d){ | |
func2(1,2,3,4,d); | |
} | |
int main(void){ | |
func1(5); | |
return 0; | |
} | |
---------------- | |
In the assembly I replaced _func1 with the following: | |
_func1: | |
popl %eax # pop the return address | |
pushl $4 | |
pushl $3 | |
pushl $2 | |
pushl $1 | |
pushl %eax # push the return address again | |
jmp _func2 # jmp to the function instead of calling it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment