[master] f96ecd7 And a third case of sizeof missing dereference spotted by LLVM

Poul-Henning Kamp phk at varnish-cache.org
Mon Aug 1 13:32:34 CEST 2011


commit f96ecd748277cc9581cdb81c711d678b2986b9bb
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