<p></p>
<p><b>@henningw</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/kamailio/kamailio/pull/2838#discussion_r699048847">src/modules/slack/slack.c</a>:</p>
<pre style='color:#555'>> + */
+static int _curl_send(const char* uri, str *post_data)
+{
+       int datasz;
+       char* send_data;
+       CURL *curl_handle;
+       CURLcode res;
+       // LM_DBG("sending to[%s]\n", uri);
+
+       datasz = snprintf(NULL, 0, BODY_FMT, slack_channel, slack_username, post_data->s, slack_icon);
+       send_data = (char*)pkg_malloc((datasz+1)*sizeof(char));
+       if(send_data==NULL) {
+        LM_ERR("Error: can not allocate pkg memory [%d] bytes\n", datasz);
+        return -1;
+    }
+    snprintf(send_data, datasz+1, BODY_FMT, slack_channel, slack_username, post_data->s, slack_icon);
</pre>
<p>This of course depends on the working of snprintf, the docs unfortunately do not give much more details. But generally it is good "defensive" programming practice to check for errors on outside library calls that you do not control/own.</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#discussion_r699048847">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZO5NRCLJUONVJCCH53T7R6TDANCNFSM5DB7SIMA">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/ABO7UZN3A3ZUE4SKHUOHIGDT7R6TDA5CNFSM5DB7SIMKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFQ7YHKA.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#discussion_r699048847",
"url": "https://github.com/kamailio/kamailio/pull/2838#discussion_r699048847",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>