tAllocate one more byte for terminating null byte in *body - phroxy - Gopher to HTTP proxy
(HTM) git clone git://git.z3bra.org/phroxy.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit bcdad97311b53db4557ec5bc06dd8ffce852610e
(DIR) parent 0823bcb34e01b1e391207e2b2aaffd61ed763c24
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Tue, 15 Sep 2020 11:35:48 +0200
Allocate one more byte for terminating null byte in *body
Diffstat:
M phroxy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/phroxy.c b/phroxy.c
t@@ -275,9 +275,10 @@ htmlize(char *data, size_t *bodysize)
}
alen = strnlen(a, sizeof(a));
- body = realloc(body, blen + alen);
+ body = realloc(body, blen + alen + 1);
memcpy(body + blen, a, alen);
blen += alen;
+ body[blen] = '\0';
}
if (bodysize)