[master] 984f145 Align ban lumps
Nils Goroll
nils.goroll at uplex.de
Tue Aug 23 16:18:14 CEST 2016
commit 984f145f8d12b68583972bca73d198e08238e011
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue Aug 23 16:16:25 2016 +0200
Align ban lumps
should fix #2050
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index e4b25e1..c475ff2 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -183,7 +183,8 @@ ban_get_lump(const uint8_t **bs)
while (**bs == 0xff)
*bs += 1;
ln = vbe32dec(*bs);
- *bs += 4;
+ *bs += PRNDUP(sizeof(uint32_t));
+ assert(PAOK(*bs));
r = (const void*)*bs;
*bs += ln;
return (r);
diff --git a/bin/varnishd/cache/cache_ban_build.c b/bin/varnishd/cache/cache_ban_build.c
index 4c1b64f..81f2dc8 100644
--- a/bin/varnishd/cache/cache_ban_build.c
+++ b/bin/varnishd/cache/cache_ban_build.c
@@ -101,7 +101,7 @@ 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[sizeof len];
+ uint8_t buf[PRNDUP(sizeof len)];
buf[0] = 0xff;
while (VSB_len(bp->vsb) & PALGN)
More information about the varnish-commit
mailing list