title: What is causing this segmentation fault?
body: <p>Noobie here. Popped open my virtual machine to edit a program, but (as far as I can remember), before I made any changes, I got a segmentation fault that wasn't happening before. I tried commenting possible causes, to no avail. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;cs50.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  int main (int argc, string argv[])
  {
  
      int keyOk = 0;
      string keyword = argv[1];
      int keyLength = strlen(keyword);
  
      do
      {    
         if (argc != 2)
          {
              printf("TOo many words\n");
              return 1; 
          }        
          else    
          {
              for (int i = 0; i &lt; keyLength; i++)
              {
                  if(isalpha(keyword[i] == 0 ))
                  {
                      printf("Only use alpha\n");
                      return 1;
                  }       
              }
              keyOk = 1;
          }
      }
      while(keyOk == 0);
  
      string cipherInput = GetString();
      int cipherLength = strlen(cipherInput);
      int j = 0;
  
  
      for(int i = 0; i &lt; cipherLength; i++)
          {
              if(isalpha(cipherInput[i]))
              {
                  if(islower(keyword[j]))
                  {
                      if(islower(cipherInput[i]))
                      {
                          printf("%c", ((((cipherInput[i] - 97)+(keyword[j]-97))%26)+97));
                      }
                      else
                      {
                          printf("%c", ((((cipherInput[i] - 65)+(keyword[j]-97))%26)+65));
                      }
  
                  }
                  else
                  {
                      if(islower(cipherInput[i]))
                      {
                          printf("%c", ((((cipherInput[i] - 97)+(keyword[j]-65))%26)+97));
                      }
                      else
                      {
                          printf("%c", ((((cipherInput[i] - 65)+(keyword[j]-65))%26)+65));
                      }
                  }
  
                  j = i % cipherLength;             
              }
              else
              {
                  printf("%c", cipherInput[i]);
              }
          }     
      //printf("%s\n", keyword);
      printf("\n");
  }
  </code></pre>
  
  <p>GDB output, I couldn't figure out what it meant. Usually it just gives me a line number...</p>
  
  <pre><code>New LWP 31749]
  Core was generated by `./vigenere'.
  Program terminated with signal 11, Segmentation fault.
  #0  __strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:50
  50      movdqu  (%edi), %xmm1
  </code></pre>