]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a use-after-free bug in dns_xfrin_create()
authorAram Sargsyan <aram@isc.org>
Thu, 13 Apr 2023 14:42:29 +0000 (14:42 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Fri, 14 Apr 2023 07:39:38 +0000 (07:39 +0000)
'xfr' is used after detaching the only reference, which would
have destroyed the object.

Call dns_xfrin_detach() only after the final use of 'xfr'.

lib/dns/xfrin.c

index 99190cc385e434cdd65337779916d8ca32997413..063423b665f5c99f47bbcfacd9153acc9634ca7b 100644 (file)
@@ -723,6 +723,7 @@ dns_xfrin_create(dns_zone_t *zone, dns_rdatatype_t xfrtype,
        if (result != ISC_R_SUCCESS) {
                atomic_store(&xfr->shuttingdown, true);
                xfr->shutdown_result = result;
+               xfrin_log(xfr, ISC_LOG_ERROR, "zone transfer setup failed");
                dns_xfrin_detach(xfrp);
        }
 
@@ -730,10 +731,6 @@ dns_xfrin_create(dns_zone_t *zone, dns_rdatatype_t xfrtype,
                dns_db_detach(&db);
        }
 
-       if (result != ISC_R_SUCCESS) {
-               xfrin_log(xfr, ISC_LOG_ERROR, "zone transfer setup failed");
-       }
-
        return (result);
 }