summaryrefslogtreecommitdiff
path: root/src/plugins/relay/relay-http.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-24 21:24:51 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-24 21:24:51 +0200
commit4baf0e85260211a8938cab8d62efc51665526ad2 (patch)
treef2ad5d61fb047ddd574fdbc66fa030f25e1d713a /src/plugins/relay/relay-http.c
parent1e08b1119ac32c6419d4a4177f982b899164fcb2 (diff)
downloadweechat-4baf0e85260211a8938cab8d62efc51665526ad2.zip
relay: add final '\0' in body when parsing HTTP response
This fixes tests on Debian GNU/Hurd.
Diffstat (limited to 'src/plugins/relay/relay-http.c')
-rw-r--r--src/plugins/relay/relay-http.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/relay/relay-http.c b/src/plugins/relay/relay-http.c
index 58879b4fa..ee8888888 100644
--- a/src/plugins/relay/relay-http.c
+++ b/src/plugins/relay/relay-http.c
@@ -1584,9 +1584,12 @@ relay_http_parse_response (const char *data)
else if (http_resp->status == RELAY_HTTP_BODY)
{
http_resp->body_size = strlen (ptr_data);
- http_resp->body = malloc (http_resp->body_size);
+ http_resp->body = malloc (http_resp->body_size + 1);
if (http_resp->body)
+ {
memcpy (http_resp->body, ptr_data, http_resp->body_size);
+ http_resp->body[http_resp->body_size] = '\0';
+ }
http_resp->status = RELAY_HTTP_END;
}
else