Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void f() { printf("hello, world\n"); }
- char prog[6];
- typedef void (*callable)();
- int main() {
- prog[0] = 0xe8;
- *(int *)(prog+1) = ((char *)f)-((char *)(prog+5));
- printf("%d\n", *(prog+1));
- prog[5] = 0xc3;
- ((callable)prog)();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement