commit 8b832f0a3727603ca203d3c4b3cab4667fbfc462
parent c49622e4ae428d185772e99ac06ae1760d064766
Author: Joris Vink <joris@coders.se>
Date: Thu, 20 Jun 2013 23:30:03 +0200
fix off-by-one
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/http.c b/src/http.c
@@ -290,15 +290,15 @@ http_header_recv(struct netbuf *nb)
kore_debug("http_header_recv(%p)", nb);
- ch = nb->buf[nb->len];
- nb->buf[nb->len] = '\0';
+ ch = nb->buf[nb->len - 1];
+ nb->buf[nb->len - 1] = '\0';
if ((end_headers = (u_int8_t *)strrchr((char *)nb->buf, '\r')) == NULL)
return (KORE_RESULT_OK);
if (nb->len > 2 && strncmp(((char *)end_headers - 2), "\r\n\r\n", 4))
return (KORE_RESULT_OK);
- nb->buf[nb->len] = ch;
+ nb->buf[nb->len - 1] = ch;
nb->flags |= NETBUF_FORCE_REMOVE;
end_headers += 2;