[3.0] f535d86 And a third case of sizeof missing dereference spotted by LLVM

Tollef Fog Heen tfheen at varnish-cache.org
Wed Aug 17 11:25:35 CEST 2011


commit f535d862d622634db8e74a483d3d42ab4101e417
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 1 11:32:08 2011 +0000

    And a third case of sizeof missing dereference spotted by LLVM

diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
index 15d1b52..2141cc4 100644
--- a/bin/varnishd/cache_http.c
+++ b/bin/varnishd/cache_http.c
@@ -911,9 +911,11 @@ http_ClrHeader(struct http *to)
 {
 
 	CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-	/* XXX: don't to->f = to->v;  it would kill pipelining */
 	to->nhd = HTTP_HDR_FIRST;
-	memset(to->hd, 0, sizeof to->hd);
+	to->status = 0;
+	to->protover = 0;
+	to->conds = 0;
+	memset(to->hd, 0, sizeof *to->hd * to->shd);
 }
 
 /*--------------------------------------------------------------------*/



More information about the varnish-commit mailing list