From 4c9547cd12b5bb569f10b368eb6bb04d897d596f Mon Sep 17 00:00:00 2001 From: Erwin Lansing Date: Mon, 15 Dec 2014 12:14:41 +0000 Subject: Vendor import of BIND 9.9.6-P1 Sponsored by: DK Hostmaster A/S --- lib/isc/netaddr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/isc/netaddr.c') diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index 0940df1713e5d..dcbfba42eae88 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -235,11 +235,12 @@ isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen) { nbytes = prefixlen / 8; nbits = prefixlen % 8; if (nbits != 0) { + INSIST(nbytes < ipbytes); if ((p[nbytes] & (0xff>>nbits)) != 0U) return (ISC_R_FAILURE); nbytes++; } - if (memcmp(p + nbytes, zeros, ipbytes - nbytes) != 0) + if (nbytes < ipbytes && memcmp(p + nbytes, zeros, ipbytes - nbytes) != 0) return (ISC_R_FAILURE); return (ISC_R_SUCCESS); } -- cgit v1.2.3