title: strlcpy or memcpy?
body: <p>I know strcpy is not secure when dealing with buffers, however in my code i have this</p>
  
  <pre><code>static char    buf[HUGE_BUFFER_SIZE + 1];
  char servername[200];
  int length = 0;
  char *out = NULL;
          length = strlen(buf);
          out = alloca(strlen(servername) + length + 5);
          length = strlen(servername);
          strcpy(out, servername);
          out[length] = ' ';
          out[length + 1] = 0;
          strcat(out, buf);
  </code></pre>
  
  <p>If I change strcpy to strlcpy and use a sizeof for arg3, the output is garbled. Is there an easier way than using memcpy (which looks like I might have to do?) Im trying to avoid using insecure functions like strcpy and friends. Is there an easier way to accomplish the above with less copying of functions, and strnlens/alloca?</p>