title: What might be causing this buffer overflow?
body: <p>Hello I am trying to compile the following code, </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  int main()
  {
  int i;
  char a[3] = {'1', '2', '3'},b[3] = {'3', '2', '1'};
  strcpy(a,b);
  for(i=0; i&lt;3; i++)
  printf("%s",a);
  return 0;
  }
  </code></pre>
  
  <p>But I am getting the following error(<code>Buffer Overflow</code>)</p>
  
  <pre><code>*** buffer overflow detected ***: ./prog terminated
  ======= Backtrace: =========
  /lib/libc.so.6(__fortify_fail+0x48)[0xb7653ae8]
  /lib/libc.so.6[0xb7651b30]
  /lib/libc.so.6(__strcpy_chk+0x44)[0xb7650e14]
  ./prog[0x80484c9]
  ./prog[0x80483c1]
  ======= Memory map: ========
  </code></pre>
  
  <p>Now I don't get what is causing a buffer overflow here. Can anyone please help me out with it? 
  Thanks in adcance.</p>