From: Aram Sargsyan Date: Thu, 17 Mar 2022 14:47:15 +0000 (+0000) Subject: Use 'bname' in dns_catz_update_from_db() only when it is ready X-Git-Tag: v9.19.0~42^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5a6362e922c024b196758e9cc5b580b6d56b86a;p=thirdparty%2Fbind9.git Use 'bname' in dns_catz_update_from_db() only when it is ready There is a possible code path of using the uninitialized `bname` character array while logging an error message. Initialize the `bname` buffer earlier in the function. Also, change the initialization routine to use a helper function. --- diff --git a/lib/dns/catz.c b/lib/dns/catz.c index ca71a5d36a2..b02157618a5 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -1786,12 +1786,13 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) { dns_rdatasetiter_t *rdsiter = NULL; dns_rdataset_t rdataset; char bname[DNS_NAME_FORMATSIZE]; - isc_buffer_t ibname; uint32_t vers; REQUIRE(DNS_DB_VALID(db)); REQUIRE(DNS_CATZ_ZONES_VALID(catzs)); + dns_name_format(&db->origin, bname, DNS_NAME_FORMATSIZE); + /* * Create a new catz in the same context as current catz. */ @@ -1805,10 +1806,6 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) { return; } - isc_buffer_init(&ibname, bname, DNS_NAME_FORMATSIZE); - result = dns_name_totext(&db->origin, true, &ibname); - INSIST(result == ISC_R_SUCCESS); - result = dns_db_getsoaserial(db, oldzone->dbversion, &vers); if (result != ISC_R_SUCCESS) { /* A zone without SOA record?!? */