<p></p>
<p>The snprintf() for getting datasz should be checked, because can fail on unexpected characters - from the manual:</p>
<pre><code>[EILSEQ]           An invalid wide character code was encountered.
</code></pre>
<p>That will make it safer when wanting to send data taken from SIP traffic (e.g., body of requests).</p>
<p>On negative return code, likely pkg_malloc() will fail, requested size being big.</p>
<p>The second snprintf() is unlikely to fail, but I would use pkg_mallocxz() or set send_data[0] = '\0' before it so in case it fails for what so ever unknown reason, then the CURL library doesn't get a buffer with garbage and does not go beyond allocated buffer to find the '\0'.</p>
<p>For reusing http_client, it would be good to review all modules. Can be done for this one also after merging, it is easier to work directly in repo than as PR.</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/pull/2838#issuecomment-909005630">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZOHP32423VN7S2JG63T7SFN5ANCNFSM5DB7SIMA">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/ABO7UZPU3NAVO3VEVDC2QQLT7SFN5A5CNFSM5DB7SIMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGYXFGPQ.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/pull/2838#issuecomment-909005630",
"url": "https://github.com/kamailio/kamailio/pull/2838#issuecomment-909005630",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>