[master] 345eb51 Init the buffer so padding bytes for alignment are always the same

Nils Goroll nils.goroll at uplex.de
Wed Aug 24 10:51:11 CEST 2016


commit 345eb517ea015c7905f6821b8d669bbbe46b1692
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Aug 24 10:48:29 2016 +0200

    Init the buffer so padding bytes for alignment are always the same
    
    Otherwise ban_equal may not work due to undefined contents of buf
    
    Should fix c19.vtc regression from 984f145f8d12b68583972bca73d198e08238e011

diff --git a/bin/varnishd/cache/cache_ban_build.c b/bin/varnishd/cache/cache_ban_build.c
index 81f2dc8..2ec9544 100644
--- a/bin/varnishd/cache/cache_ban_build.c
+++ b/bin/varnishd/cache/cache_ban_build.c
@@ -101,9 +101,8 @@ BAN_Abandon(struct ban_proto *bp)
 static void
 ban_add_lump(const struct ban_proto *bp, const void *p, uint32_t len)
 {
-	uint8_t buf[PRNDUP(sizeof len)];
+	uint8_t buf[PRNDUP(sizeof len)] = { 0xff };
 
-	buf[0] = 0xff;
 	while (VSB_len(bp->vsb) & PALGN)
 		VSB_putc(bp->vsb, buf[0]);
 	vbe32enc(buf, len);



More information about the varnish-commit mailing list