[master] b2bbb50 Neuter another case where AddressSanitizer chokes on FreeBSD's hyperwide memcmp()
Poul-Henning Kamp
phk at FreeBSD.org
Tue Feb 2 08:52:11 CET 2016
commit b2bbb5051c691eeed3373af0eeff3448a94b2867
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Feb 2 00:26:39 2016 +0000
Neuter another case where AddressSanitizer chokes on FreeBSD's
hyperwide memcmp()
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 2b71d94..2838914 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -143,10 +143,10 @@ ban_equal(const uint8_t *bs1, const uint8_t *bs2)
/*
* Compare two ban-strings.
- * The memcmp() is safe because the first field we compare is the
- * length and that is part of the fixed header structure.
*/
u = vbe32dec(bs1 + BANS_LENGTH);
+ if (u != vbe32dec(bs2 + BANS_LENGTH))
+ return (0);
return (!memcmp(bs1 + BANS_LENGTH, bs2 + BANS_LENGTH, u - BANS_LENGTH));
}
More information about the varnish-commit
mailing list