[master] 8aa461e Put a canary byte at the end of workspaces

Poul-Henning Kamp phk at FreeBSD.org
Thu Oct 16 11:14:26 CEST 2014


commit 8aa461e2aab84e3da6af6dc37eab6db37fc968cc
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 16 09:14:05 2014 +0000

    Put a canary byte at the end of workspaces

diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c
index 42e6121..aad9fec 100644
--- a/bin/varnishd/cache/cache_ws.c
+++ b/bin/varnishd/cache/cache_ws.c
@@ -57,6 +57,7 @@ WS_Assert(const struct ws *ws)
 		assert(ws->r <= ws->e);
 		assert(PAOK(ws->r));
 	}
+	assert(*ws->e == 0x15);
 }
 
 /*
@@ -75,8 +76,9 @@ WS_Init(struct ws *ws, const char *id, void *space, unsigned len)
 	ws->magic = WS_MAGIC;
 	ws->s = space;
 	assert(PAOK(space));
-	len = PRNDDN(len);
+	len = PRNDDN(len - 1);
 	ws->e = ws->s + len;
+	*ws->e = 0x15;
 	ws->f = ws->s;
 	assert(id[0] & 0x40);
 	assert(strlen(id) < sizeof ws->id);



More information about the varnish-commit mailing list