From: Bastian Dehn Date: Sun, 28 Jan 2024 19:53:51 +0000 (+0100) Subject: fix response termination with nul X-Git-Tag: v1.0.0^2~398 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=336eb7321182c1f3c1465948c267c9eef28d4f9a;p=sane-kds-s2000w-net.git fix response termination with nul --- diff --git a/src/kds_s2000w_client.c b/src/kds_s2000w_client.c index 0689533..350fd6a 100644 --- a/src/kds_s2000w_client.c +++ b/src/kds_s2000w_client.c @@ -9,12 +9,13 @@ size_t _kds_s2000w_client_callback(char *ptr, size_t size, size_t nmemb, void *u response* data = (response*) userdata; size_t fullsize = size * nmemb; - data->data = realloc(data->data, fullsize + 1); + data->data = realloc(data->data, fullsize + sizeof(char)); if (!data->data) return 0; memcpy(data->data, ptr, fullsize); - data->size = fullsize + 1; + data->size = fullsize + sizeof(char); + data->data[data->size] = 0; return fullsize; }