<p></p>
<h3>Description</h3>
<p>I have compiled Kamailio with google ASAN module and faced issue where the string PV with NULL value cannot be copied.<br>
Using GDB I found this function call triggers error when Google ASAN is used, <code>value->s.s = NULL</code>, <code>value->s.len = 0</code></p>
<pre><code>memcpy(var->v.value.s.s, value->s.s, value->s.len);
</code></pre>
<p><a href="https://github.com/kamailio/kamailio/blob/caccb13e29ee12166c8101efa0d5ab2745876413/src/modules/pv/pv_svar.c#L137">Link</a><br>
This happens only when ASAN is used.<br>
Without ASAN same function call with the same values does not trigger an error.</p>
<p>In my test case this function called from <a href="https://github.com/kamailio/kamailio/blob/caccb13e29ee12166c8101efa0d5ab2745876413/src/modules/lost/functions.c#L1285"><code>lost/functions.c:1285</code></a></p>
<p>To compile with asan used extra flags</p>
<pre><code>-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment 
</code></pre>
<h3>Troubleshooting</h3>
<h4>Log Messages</h4>
<pre><code> 0(913407) INFO: {1 1 INVITE 1-455779@172.21.0.84} lost [functions.c:891]: lost_function(): ### LOST urn [urn:sip:911@3.236.25.254:5060]
 0(913407) INFO: {1 1 INVITE 1-455779@172.21.0.84} lost [functions.c:983]: lost_function(): ### LOST loc        [<112233445566@jim.com>]
 0(913407) ERROR: {1 1 INVITE 1-455779@172.21.0.84} lost [utilities.c:336]: lost_get_content(): could not get XML node content
pv_svar.c:137:3: runtime error: null pointer passed as argument 2, which is declared to never be null
</code></pre>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<p>current master, test <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/kamailio/kamailio/commit/375f86b69e11cf835ae919873d3cd56f32d589c8/hovercard" href="https://github.com/kamailio/kamailio/commit/375f86b69e11cf835ae919873d3cd56f32d589c8"><tt>375f86b</tt></a></p>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<p>Centos 8</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2913">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZK2T7GIRZFWMD3WZQDUJROT7ANCNFSM5HBPWM6A">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/ABO7UZO7Y3ZLJ7KQU3L5G53UJROT7A5CNFSM5HBPWM6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4PQBZNVQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2913",
"url": "https://github.com/kamailio/kamailio/issues/2913",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>