RPZ: Don't diff keys out of bounds, found via Valgrind (#38559)

(cherry picked from commit e58eb371a0)

Conflicts:
	CHANGES
This commit is contained in:
Mukund Sivaraman
2015-02-18 12:54:06 +05:30
parent 53e49fb5a8
commit 73639a33fa
2 changed files with 8 additions and 2 deletions
+5
View File
@@ -1,3 +1,8 @@
4062. [bug] Fix an out-of-bounds read in RPZ code. If the
read succeeded, it doesn't result in a bug
during operation. If the read failed, named
could segfault. [RT #38559]
--- 9.10.2 released ---
--- 9.10.2rc2 released ---
+3 -2
View File
@@ -866,13 +866,14 @@ diff_keys(const dns_rpz_cidr_key_t *key1, dns_rpz_prefix_t prefix1,
dns_rpz_prefix_t maxbit, bit;
int i;
bit = 0;
maxbit = ISC_MIN(prefix1, prefix2);
/*
* find the first differing words
*/
for (i = 0, bit = 0;
bit <= maxbit;
for (i = 0;
bit < maxbit;
i++, bit += DNS_RPZ_CIDR_WORD_BITS) {
delta = key1->w[i] ^ key2->w[i];
if (delta != 0) {