Commit 84f5f198 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Fix issue for N1N2 message transfer with curl multi

parent 4007c229
......@@ -1173,10 +1173,10 @@ CURL* smf_sbi::curl_create_handle(
// create handle for a curl request
CURL* curl = curl_easy_init();
uint32_t str_len = data.length();
char data_str[str_len + 1] = {};
data.copy(data_str, str_len);
data_str[str_len] = '\0';
uint32_t str_len = data.length();
char* data_str = (char*) malloc(str_len + 1);
memset(data_str, 0, str_len + 1);
memcpy((void*) data_str, (void*) data.c_str(), str_len);
if (curl) {
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
......@@ -1192,6 +1192,8 @@ CURL* smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, data.length());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data_str);
}
free_wrapper((void**) &data_str);
return curl;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment