[4.0] 3880333 Zero overflow VSM allocations.
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Wed May 11 17:09:06 CEST 2016
commit 3880333fcf6067530139462d08d56d6def099dad
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Mar 9 21:02:09 2016 +0000
Zero overflow VSM allocations.
Submitted by: Pål Hermunn Johansen
diff --git a/bin/varnishd/common/common_vsm.c b/bin/varnishd/common/common_vsm.c
index 90863c3..c16261d 100644
--- a/bin/varnishd/common/common_vsm.c
+++ b/bin/varnishd/common/common_vsm.c
@@ -233,10 +233,11 @@ VSM_common_alloc(struct vsm_sc *sc, ssize_t size,
if (vr == NULL) {
/*
* No space in VSM, return malloc'd space
+ * This space will not be visible via the VSM
*/
ALLOC_OBJ(vr, VSM_RANGE_MAGIC);
AN(vr);
- vr->ptr = malloc(size);
+ vr->ptr = calloc(size, 1);
AN(vr->ptr);
vr->len = size;
VTAILQ_INSERT_TAIL(&sc->r_bogus, vr, list);
More information about the varnish-commit
mailing list