From b1086a5561c8024fc39b5250063fc901c27eef06 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 1 Dec 2022 12:51:30 +1100 Subject: [PATCH] Add missing DbC magic checks Checking for value != NULL is not sufficient to detect use after free errors. --- lib/dns/catz.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dns/catz.c b/lib/dns/catz.c index bd740b1685..ec048dfd8f 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -791,7 +791,7 @@ cleanup_ht: void dns_catz_catzs_set_view(dns_catz_zones_t *catzs, dns_view_t *view) { REQUIRE(DNS_CATZ_ZONES_VALID(catzs)); - REQUIRE(view != NULL); + REQUIRE(DNS_VIEW_VALID(view)); /* Either it's a new one or it's being reconfigured. */ REQUIRE(catzs->view == NULL || !strcmp(catzs->view->name, view->name)); @@ -1006,7 +1006,7 @@ void dns_catz_catzs_detach(dns_catz_zones_t **catzsp) { dns_catz_zones_t *catzs; - REQUIRE(catzsp != NULL && *catzsp != NULL); + REQUIRE(catzsp != NULL && DNS_CATZ_ZONES_VALID(*catzsp)); catzs = *catzsp; *catzsp = NULL; @@ -1833,7 +1833,7 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *zone, dns_catz_entry_t *entry, bool special = false; REQUIRE(DNS_CATZ_ZONE_VALID(zone)); - REQUIRE(entry != NULL); + REQUIRE(DNS_CATZ_ENTRY_VALID(entry)); REQUIRE(buffer != NULL && *buffer != NULL); isc_buffer_allocate(zone->catzs->mctx, &tbuf, @@ -1931,7 +1931,7 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry, char zname[DNS_NAME_FORMATSIZE]; REQUIRE(DNS_CATZ_ZONE_VALID(zone)); - REQUIRE(entry != NULL); + REQUIRE(DNS_CATZ_ENTRY_VALID(entry)); REQUIRE(buf != NULL && *buf == NULL); /* @@ -2066,7 +2066,7 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) { isc_region_t r; REQUIRE(DNS_DB_VALID(db)); - REQUIRE(fn_arg != NULL); + REQUIRE(DNS_CATZ_ZONES_VALID(fn_arg)); catzs = (dns_catz_zones_t *)fn_arg; dns_name_toregion(&db->origin, &r);