Skip to content

Instantly share code, notes, and snippets.

@slembcke
Created May 12, 2010 16:52
Show Gist options
  • Save slembcke/398816 to your computer and use it in GitHub Desktop.
Save slembcke/398816 to your computer and use it in GitHub Desktop.
#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