tCompute length using strnlen() for HTML data - phroxy - Gopher to HTTP proxy
(HTM) git clone git://git.z3bra.org/phroxy.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit a833b87179ac706192d6f767d94d23c0e3507c67
(DIR) parent fcf983a1138c7e93933c3722ec8735b92d57432b
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Mon, 14 Sep 2020 16:32:49 +0200
Compute length using strnlen() for HTML data
Diffstat:
M phroxy.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/phroxy.c b/phroxy.c
t@@ -258,7 +258,7 @@ htmlize(char *data, size_t *bodysize)
}
if (bodysize)
- *bodysize = blen;
+ *bodysize = strnlen(body, blen);
return body;
}
t@@ -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;
}
t@@ -335,6 +335,8 @@ serveitem(char item, char *data, size_t len)
send += sent;
}
+ free(data);
+
return 0;
}