title: stack smashing error detected
body: <p>when i try the following snippet i am getting an error called stack smashing detected. what could be the reason for this potential bug? Can some one explain?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;unistd.h&gt;
  #include&lt;sys/types.h&gt;
  int glob=88;
  int main()
  {
      int loc=2;
      pid_t pid=vfork();
      if(pid==0)
      {
          printf("Inside child");
          glob++;
          loc++;
          printf("%d %d" ,glob,loc);
      }
      else
      {
          printf("Inside parent");
          glob++;
          loc++;
          printf("%d %d",glob,loc);
      }
  }
  </code></pre>
  
  <p>and the output when I run this code is like that</p>
  
  <pre><code>user018@sshell ~ $ gcc one.c
  user018@sshell ~ $ ./a.out
  Inside child89 3Inside parent90 945733057*** stack smashing detected ***: a.out
  - terminated
  a.out: stack smashing attack in function &lt;unknown&gt; - terminated
  KILLED
  </code></pre>