r334 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Jul 5 16:40:14 CEST 2006


Author: phk
Date: 2006-07-05 16:40:14 +0200 (Wed, 05 Jul 2006)
New Revision: 334

Modified:
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
Fix off by one


Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-05 14:40:03 UTC (rev 333)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-05 14:40:14 UTC (rev 334)
@@ -192,6 +192,7 @@
 	*b = hp->t;
 	*e = hp->t + len;
 	hp->t += len;
+	assert(hp->t <= hp->v);
 	return (1);
 }
 
@@ -217,6 +218,7 @@
 			;
 		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 @@
 			VSLR(SLT_LostHeader, fd, p, q);
 		}
 	}
+	assert(hp->t <= hp->v);
 	assert(hp->t == r);
 }
 
@@ -316,7 +319,10 @@
 			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 @@
 	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;




More information about the varnish-commit mailing list