r300 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jul 4 16:45:01 CEST 2006


Author: phk
Date: 2006-07-04 16:45:01 +0200 (Tue, 04 Jul 2006)
New Revision: 300

Modified:
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
Make room for protective terminating NUL


Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-04 14:19:12 UTC (rev 299)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-04 14:45:01 UTC (rev 300)
@@ -305,11 +305,13 @@
 {
 	struct http *hp = arg;
 	char *p;
+	unsigned l;
 	int i;
 
-	assert(hp->v < hp->e);
+	l = hp->e - hp->v;
+	assert(l > 1);
 	errno = 0;
-	i = read(fd, hp->v, hp->e - hp->v);
+	i = read(fd, hp->v, l - 1);
 	if (i <= 0) {
 		if (hp->v != hp->s)
 			VSL(SLT_HttpError, fd,




More information about the varnish-commit mailing list