title: g++ + strncat: might overflow destination buffer
body: <p>I need to include an C function in my C++ program, when compiling the Code with g++ I get the following warning:</p>
  
  <pre><code>In function ‘char* strncat(char*, const char*, size_t)’,
      inlined from ‘int get_usage(pid_t, pstat*)’ at src/getusage.c:24:
  /usr/include/bits/string3.h:154: warning: call to
  char* __builtin___strncat_chk(char*, const char*, long unsigned int,
  long unsigned int) might overflow destination buffer
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>int pidof(const char* process_name){
  char cmd[50] ="pidof ";
  strncat(cmd, process_name, sizeof(cmd) - strlen(cmd) -1); 
  [..]
  </code></pre>
  
  <p>How do I get rid of this warning?</p>