[master] 72e08e2 Fix a VSM segment list corruption bug, spotted by inspection.

Poul-Henning Kamp phk at varnish-cache.org
Fri Mar 11 21:06:26 CET 2011


commit 72e08e2a9de1b15b27c07a4f08764f1238308e13
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Mar 11 20:05:57 2011 +0000

    Fix a VSM segment list corruption bug, spotted by inspection.

diff --git a/bin/varnishd/vsm.c b/bin/varnishd/vsm.c
index ccdfa38..4d689ab 100644
--- a/bin/varnishd/vsm.c
+++ b/bin/varnishd/vsm.c
@@ -181,7 +181,7 @@ VSM_Alloc(unsigned size, const char *class, const char *type, const char *ident)
 			/* Mark as inconsistent while we write string fields */
 		seq = vsm_mark();
 
-		if (size < sha->len) {
+		if (size + sizeof (*sha) < sha->len) {
 			sha2 = (void*)((uintptr_t)sha + size);
 
 			memset(sha2, 0, sizeof *sha2);



More information about the varnish-commit mailing list