[sr-dev] [kamailio/kamailio] slack: new module, send message to slack channel (#2838)

Arsen Semenov notifications at github.com
Tue Aug 31 08:08:33 CEST 2021


@arsperger commented on this pull request.



> + */
+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);

thank you for your notes. I am wondering, if the above snprintf check is passed, what could be a reason for this one to fail? do we really need to error check this one?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2838#discussion_r699009988
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20210831/4888ef64/attachment.htm>


More information about the sr-dev mailing list