title: Why is my buffer overflow attempt segfaulting?
body: <p>I'm wondering why a buffer overflow exploit isn't working in a particular scenario. As of now the overflow I am working on can redirect the return address, and when I focus on a piece of memory say <code>&lt;_fini&gt;</code> the program will exit without performing anything else that comes after the function. The strange thing is when I attempt to redirect the memory to an environment variable. For some reason this does not work due to a segmentation fault. Anyone have any ideas why this is?</p>
  
  <p>Here is the code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void func(char *buff){  
      char buffer[5];
      strcpy(buffer, buff);
      printf("%s\n", buffer);
  }
  
  int main(int argc, char *argv[]){
      func(argv[1]);
      printf("I'm done!\n");
      return 0;
  }
  </code></pre>