]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix bad-cache assert
authorEvan Hunt <each@isc.org>
Mon, 2 Jul 2012 17:05:20 +0000 (10:05 -0700)
committerEvan Hunt <each@isc.org>
Mon, 2 Jul 2012 17:05:41 +0000 (10:05 -0700)
3346. [security] Bad-cache data could be used before it was
initialized, causing an assert. [RT #30025]

CHANGES
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index fde8a033743514c62ae073109503ec2e79a3d849..52d1705162ff0b59777e798d0934d25694aa0617 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3346.  [security]      Bad-cache data could be used before it was
+                       initialized, causing an assert. [RT #30025]
+
 3343.   [bug]          Relax isc_random_jitter() REQUIRE tests. [RT #29821]
 
 3342.  [bug]           Change #3314 broke saving of stub zones to disk
index 632cfb4a7abf0d9ee76e419574db3f754d9adba0..e56dbbd6b8137146120f72292b4595922bb958ca 100644 (file)
@@ -8124,6 +8124,7 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name,
                        goto cleanup;
                bad->type = type;
                bad->hashval = hashval;
+               bad->expire = *expire;
                isc_buffer_init(&buffer, bad + 1, name->length);
                dns_name_init(&bad->name, NULL);
                dns_name_copy(name, &bad->name, &buffer);
@@ -8135,8 +8136,8 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name,
                if (resolver->badcount < resolver->badhash * 2 &&
                    resolver->badhash > DNS_BADCACHE_SIZE)
                        resizehash(resolver, &now, ISC_FALSE);
-       }
-       bad->expire = *expire;
+       } else
+               bad->expire = *expire;
  cleanup:
        UNLOCK(&resolver->lock);
 }