From: Bastian Dehn Date: Sat, 4 Jan 2025 10:34:08 +0000 (+0100) Subject: fix null terminated stream X-Git-Tag: v1.0.23^2~8 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=20ab2653ccbcca57bce77b07f378b96c707ae6c5;p=sane-kds-s2000w-net.git fix null terminated stream --- diff --git a/src/kds_s2000w_client.c b/src/kds_s2000w_client.c index 79a0169..5443de6 100644 --- a/src/kds_s2000w_client.c +++ b/src/kds_s2000w_client.c @@ -49,9 +49,10 @@ void _kds_s2000w_client_stream_to_response(char* mem, response* resp, size_t* si { debug_printf(ALL, "kds_s2000w_client_stream_to_response"); - resp->data = realloc(resp->data, sizeof(char) * *size); - resp->size = *size; - memcpy(resp->data, mem, *size); + size_t incl_null_term = *size + 1; + resp->data = realloc(resp->data, sizeof(char) * incl_null_term); + resp->size = incl_null_term; + memcpy(resp->data, mem, incl_null_term); } void _kds_s2000w_client_set_ssl_verification_off(CURL* curl)