]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3761. [bug] Address dangling reference bug in dns_keytable_add.
authorMark Andrews <marka@isc.org>
Thu, 27 Feb 2014 05:55:46 +0000 (16:55 +1100)
committerMark Andrews <marka@isc.org>
Thu, 27 Feb 2014 05:55:46 +0000 (16:55 +1100)
                        [RT #35471]

CHANGES
lib/dns/keytable.c

diff --git a/CHANGES b/CHANGES
index f949607c231141526ef71797e9d6774f3003180f..41c7d8e51bdd650b9ce402f9da866ddc46916b8a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3761.  [bug]           Address dangling reference bug in dns_keytable_add.
+                       [RT #35471]
+
 3760.  [bug]           Improve SIT with native PKCS#11 and on Windows.
                        [RT #35433]
 
index c49847f326ad7d181de58fbff643915e4b2c733d..8c57d632cd4c7ce93ad2a8f40f4b97067931b181 100644 (file)
@@ -174,6 +174,7 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed,
                        for (k = node->data; k != NULL; k = k->next) {
                                if (k->key == NULL) {
                                        k->key = *keyp;
+                                       *keyp = NULL; /* transfer ownership */
                                        break;
                                }
                                if (dst_key_compare(k->key, *keyp) == ISC_TRUE)
@@ -182,7 +183,7 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed,
 
                        if (k == NULL)
                                result = ISC_R_SUCCESS;
-                       else
+                       else if (*keyp != NULL)
                                dst_key_free(keyp);
                }