]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/resolve: root zone is always encloser
authorMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 18 Nov 2015 16:12:47 +0000 (17:12 +0100)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 18 Nov 2015 16:12:47 +0000 (17:12 +0100)
bad control flow, the zone cut should be checked for root, as the second
condition checks if SNAME is at/below cut so the outcome is the same for
root query

lib/resolve.c

index 51cb4f25c453fbd34e00267ba66ac7526bb7e7d5..8fc1e9a37ca7aeede87995f5b6ddafef20b6ed0a 100644 (file)
@@ -162,7 +162,7 @@ static int ns_fetch_cut(struct kr_query *qry, struct kr_request *req, knot_pkt_t
                /* If at/subdomain of parent zone cut, start from its encloser.
                 * This is for case when we get to a dead end (and need glue from parent), or DS refetch. */
                struct kr_query *parent = qry->parent;
-               if (parent && qry->sname[0] != '\0' && knot_dname_in(parent->zone_cut.name, qry->sname)) {
+               if (parent && parent->zone_cut.name[0] != '\0' && knot_dname_in(parent->zone_cut.name, qry->sname)) {
                        const knot_dname_t *encloser = knot_wire_next_label(parent->zone_cut.name, NULL);
                        ret = kr_zonecut_find_cached(req->ctx, &qry->zone_cut, encloser, &txn, qry->timestamp.tv_sec, secured);
                } else {