From 0f475d1160c2f313c310bb24f748181c0362bf61 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 5 Jul 2006 14:40:14 +0000 Subject: [PATCH] Fix off by one git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@334 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_http.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index 7ff5a8c3..fee27f29 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -192,6 +192,7 @@ http_GetTail(struct http *hp, unsigned len, char **b, char **e) *b = hp->t; *e = hp->t + len; hp->t += len; + assert(hp->t <= hp->v); return (1); } @@ -217,6 +218,7 @@ http_Dissect(struct http *hp, int fd, int rr) ; VSLR(SLT_Request, fd, hp->req, p); *p++ = '\0'; + assert(!strcmp(hp->req, "GET")); /* Next find the URI */ while (isspace(*p)) @@ -293,6 +295,7 @@ http_Dissect(struct http *hp, int fd, int rr) VSLR(SLT_LostHeader, fd, p, q); } } + assert(hp->t <= hp->v); assert(hp->t == r); } @@ -316,7 +319,10 @@ http_header_complete(struct http *hp) continue; break; } - hp->t = ++p; + if (++p > hp->v) + return (0); + hp->t = p; + assert(hp->t <= hp->v); return (1); } @@ -371,6 +377,8 @@ http_RecvHead(struct http *hp, int fd, struct event_base *eb, http_callback_f *f unsigned l; assert(hp != NULL); + assert(hp->v <= hp->e); + assert(hp->t <= hp->v); VSL(SLT_Debug, fd, "Recv t %u v %u", hp->t - hp->s, hp->v - hp->s); if (hp->t > hp->s && hp->t < hp->v) { l = hp->v - hp->t; -- 2.39.5