From: Ondřej Surý Date: Wed, 19 Jul 2023 10:07:25 +0000 (+0200) Subject: Restore the IS_STUB() condition in zone_zonecut_callback X-Git-Tag: v9.19.16~30^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40659b597854ac60d338ab88d7b9f4ecde20b5e4;p=thirdparty%2Fbind9.git Restore the IS_STUB() condition in zone_zonecut_callback After the refactoring the condition whether to use DNAME or NS for the zonecut was incorrectly simplified and the !IS_STUB() condition was removed. This was flagged by Coverity as: /lib/dns/rbt-zonedb.c: 192 in zone_zonecut_callback() 186 found = ns_header; 187 search->zonecut_sigheader = NULL; 188 } else if (dname_header != NULL) { 189 found = dname_header; 190 search->zonecut_sigheader = sigdname_header; 191 } else if (ns_header != NULL) { >>> CID 462773: Control flow issues (DEADCODE) >>> Execution cannot reach this statement: "found = ns_header;". 192 found = ns_header; 193 search->zonecut_sigheader = NULL; 194 } 195 196 if (found != NULL) { 197 /* Instead of removing the extra block, restore the !IS_STUB() condition for the first if block. --- diff --git a/lib/dns/rbt-zonedb.c b/lib/dns/rbt-zonedb.c index 0fd838bc5b4..110d7e5de96 100644 --- a/lib/dns/rbt-zonedb.c +++ b/lib/dns/rbt-zonedb.c @@ -178,7 +178,7 @@ zone_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, /* * Did we find anything? */ - if (ns_header != NULL) { + if (!IS_STUB(search->rbtdb) && ns_header != NULL) { /* * Note that NS has precedence over DNAME if both exist * in a zone. Otherwise DNAME take precedence over NS.