#include unsigned char cde[] = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" "\x80\xe8\xdc\xff\xff\xff/bin/ls"; void tst(void) { int *ret; // set ret to be the word address 2 before it's own address. // On Linux i386 this is the address of the return value // on the stack. ret = (int *)&ret+2; (*ret) = (int) cde; } int main(void) { printf("Running tst\n"); tst(); printf("tst has returned\n"); }