<p>Are these for safety reasons or have you found specific cases in other parts of code affected by not having this checks?</p>

<p>One comment I have is about the str dup functions, when the new check on len==0 results in setting dst s to NULL. Specs for malloc(0) are not very strict, saying that it can return a valid pointer for free(). However, the free(0) should not be done. With kamailio memory managers, pkg/shm malloc 0 returns a pointer of size(void*).</p>

<p>I think would be ok to set dst s to null if src s is null, but if src len is 0 and src s is not null, maybe is better to allocate it...</p>

<p>These are some thoughts, perhaps a deeper review where these str dup functions are used should be done.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/pull/401#issuecomment-157680622">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZZbjM2ChQ0KMnDr-5jncbU0yBPr3ks5pHFPRgaJpZM4Gkk2w.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/kamailio/kamailio/pull/401#issuecomment-157680622"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>