title: C6387 for memcpy, strcpy and strcpy_s
body: <p>It seems that I cannot shake the C6387 warning.</p>
  <pre><code>typedef struct HashBind{
      char* cKeyIdentifier;
      void* vValue;
  } HashBind;
  
  ....
      
  HashBind* strNewBind = malloc(sizeof(HashBind));    
  strNewBind -&gt; cKeyIdentifier = (char*) malloc((strlen(pcKey) + 1) * sizeof(char));
              
  memcpy(strNewBind -&gt; cKeyIdentifier, pcKey, strlen(pcKey + 1));
  </code></pre>
  <p>with pcKey being a const char* type. How can I get past the</p>
  <blockquote>
  <p>Warning   C6387   'strNewBind-&gt;cKeyIdentifier' could be '0':  this does not adhere to the specification for the function 'memcpy'.</p>
  </blockquote>
  <p>Same applies when I try to use strcpy or strcpy_s, instead of memcpy. Any ideas or any alternatives? How do I skip this unsafe use of of strcpy/memcpy (prevent buffer overflow)? <a href="https://stackoverflow.com/questions/59467803/c4496-and-c6387-for-using-strcpy-and-strcat">C4496 and C6387 for using strcpy and strcat</a> didn't help much :/</p>