[4.1] 6616996 Neuter another case where AddressSanitizer chokes on FreeBSD's hyperwide memcmp()
Lasse Karstensen
lkarsten at varnish-software.com
Thu Feb 11 17:14:32 CET 2016
commit 6616996ace7f99ae42c976e1fabc346dc5396039
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