]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
zonedb: fix possible NULL dereferences (Coverity)
authorDaniel Salzman <daniel.salzman@nic.cz>
Sun, 10 Aug 2025 05:58:19 +0000 (07:58 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Sun, 10 Aug 2025 05:58:19 +0000 (07:58 +0200)
src/knot/zone/zonedb-load.c

index 785820116554222b339c7b3e1ce612ccb63c3dcc..4e2db0d4634de5d7149f6a881251cc06b7f29690 100644 (file)
@@ -414,6 +414,10 @@ static void reg_reverse(conf_t *conf, knot_zonedb_t *db_new, zone_t *zone)
 
 static void unreg_reverse(zone_t *zone)
 {
+       if (zone == NULL) {
+               return;
+       }
+
        ptrnode_t *n;
        WALK_LIST(n, zone->reverse_from) {
                zone_local_notify_unsubscribe(n->d, zone);
@@ -429,6 +433,10 @@ static void unreg_reverse(zone_t *zone)
 
 static bool same_group(zone_t *old_z, zone_t *new_z)
 {
+       if (old_z == NULL || new_z == NULL) {
+               return false;
+       }
+
        if (old_z->catalog_group == NULL || new_z->catalog_group == NULL) {
                return (old_z->catalog_group == new_z->catalog_group);
        } else {