I'm writing a Linux shell code exploit. My target C code is:
 char code[] = "\xb0\x01\x31\xdb\xcd\x80";
 int main(int argc, char **argv)
 {
      int(*func)();
      func = (int (*)()) code;
      (Int)(*func)();
 }
Why does compiling and running this C program raise a segmentation fault error? The string is shell code that exits the program using the system call Int 0x80/EAX=1. The original exploit code in assembly is:
b0 01                   mov    al,0x1
31 db                   xor    ebx,ebx
cd 80                   int    0x80
 
     
    