<p>But it's still not NULL-terminated! Here's the proper fix:</p>

<pre><code>size_t len = strlen(sec);
if (len &gt; LONGKEYBUFF - 1)
    len = LONGKEYBUFF - 1;
strncpy(longkey, sec, len + 1);
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/pull/719#issuecomment-171693425">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOcicV-VQ4tEoRE1PG2okSVVFZ3ExA9ks5pZ8YIgaJpZM4GvcUS.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OpenSIPS/opensips/pull/719#issuecomment-171693425"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>