title: Using calloc and manually inputting chars results in a crash
body: <p>I have this code right here.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  int main()
  {
      int *size;
      int i = 0;
      char buf[] = "Thomas was alone";
      size = (int*)calloc(1, sizeof(buf)+1);
      for(i=0; i&lt;strlen(buf); i++)
      {
          *(size+i) = buf[i];
          printf("%c", *(size+i));
      }
      free(size);
  }
  </code></pre>
  
  <p>To my understanding calloc reserves a memspace the size of the first arg multiplied by the second, in this case 18. The length of buf is 17 and thus the for loop should not have any problems at all.</p>
  
  <p>Running this program results in the expected results ( It prints Thomas was alone ), however it crashes immediately too. This persists unless I crank up the size of calloc ( like multiplied by ten ).</p>
  
  <p>Am I perhaps understanding something wrongly?
  Should I use a function to prevent this from happening?</p>