<p>While building the sip uri in tel2sip() we have:<br>
sip_uri.s = pkg_malloc(sip_uri.len) <br>
But later in pv_set_ruri():<br>
val->rs.s[val->rs.len] = '\0';<br>
It's overwriting the q_malloc control structures (a classic type of bug already).</p>
<p>Kamailio will log a line like this before crashing:<br>
Mar 3 13:31:15 XXXXXXXX /opt/ims/sbin/kamailio[15030]: : [mem/q_malloc.c:140]: qm_debug_frag(): BUG: qm_*: prev. fragm. tail overwritten(c0c0c000, abcdefed)[0x7feaf22bd558:0x7feaf22bd588]!</p>
<p>I get this crash with long "tel:" ruris, the ones that have a ";phone-context=" param . <br>
This patch fixes it.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/kamailio/kamailio/pull/534'>https://github.com/kamailio/kamailio/pull/534</a></p>
<h4>Commit Summary</h4>
<ul>
<li>siputils: tel2sip(): fix 'off by one' when allocating memory</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/kamailio/kamailio/pull/534/files#diff-0">modules/siputils/checks.c</a>
(2)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/kamailio/kamailio/pull/534.patch'>https://github.com/kamailio/kamailio/pull/534.patch</a></li>
<li><a href='https://github.com/kamailio/kamailio/pull/534.diff'>https://github.com/kamailio/kamailio/pull/534.diff</a></li>
</ul>
<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/534">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36Zbtodg8Ut_V6wrj8Z08LY0ndoeleks5prDR8gaJpZM4Hq0Gg.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/534"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>