title: linux execve, segmentation fault (strcmp_sse42)
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  void main(){
     int x,y,status, i;
     int cnt = 0;
     int flag = 0;
     char buf[50];
     char str[50];
     char * argv[10];
     char * ptr;
  
  
     for(i=0; i&lt;10; i++){
      printf("$");
      gets(buf);
      strcpy(str, buf);
  
      ptr = strtok(buf, " ");
  
      while(ptr != NULL){
        argv[cnt] = ptr;
        cnt++;
        ptr = strtok(NULL," ");
      }
  
  
  
      if(!strcmp(argv[cnt-1], "&amp;")) {
        argv[cnt-1] = 0;
        flag = 1;
      }
      else {
          argv[cnt] = 0;
      }
  
  
  
      if(!strcmp(argv[cnt-1], "exit")) exit(0); 
  
      x=fork();
  
      if (x==0){
          sleep(1);
          printf("I am child to execute %s\n", str);
          y=execve(argv[0], argv, 0);
  
          if (y&lt;0){
             perror("exec failed");
             exit(1);
          }
  
      }
      else {
        if(flag == 0) { 
            wait(&amp;status); 
        }
      }
  
  
      flag = 0;
      cnt = 0;
     }
  }
  </code></pre>
  
  <p>run this code in linux then, 
  segement falut (core dump)</p>
  
  <p>also when using gdb,</p>
  
  <p>==========================================================</p>
  
  <p>Program received signal SIGSEGV, 
  Segmentation fault.
  0x0000003b6572fa96 in __strcmp_sse42 () 
  from /lib64/libc.so.6</p>
  
  <p>==========================================================</p>
  
  <p>why it is not working?</p>
  
  <p>if I type
  /bin/ls -al (anything without '&amp;')
  good working</p>
  
  <p>buf type
  /bin/ls -al &amp;
  error </p>