phroxy

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/phroxy.git
Log | Files | Refs | LICENSE

commit a833b87179ac706192d6f767d94d23c0e3507c67
parent fcf983a1138c7e93933c3722ec8735b92d57432b
Author: Willy Goiffon <dev@z3bra.org>
Date:   Mon, 14 Sep 2020 16:32:49 +0200

Compute length using strnlen() for HTML data

Diffstat:
Mphroxy.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/phroxy.c b/phroxy.c @@ -258,7 +258,7 @@ htmlize(char *data, size_t *bodysize) } if (bodysize) - *bodysize = blen; + *bodysize = strnlen(body, blen); return body; } @@ -277,7 +277,7 @@ htmlwrap(char *data, size_t len, size_t *htmlsize) snprintf(html, hlen, htmlfmt, data); if (htmlsize) - *htmlsize = hlen; + *htmlsize = strnlen(html, hlen); return html; } @@ -335,6 +335,8 @@ serveitem(char item, char *data, size_t len) send += sent; } + free(data); + return 0; }