]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Try to fix crash at +sigchase +topdown
authorPetr Menšík <pemensik@redhat.com>
Thu, 24 Jan 2019 11:55:24 +0000 (12:55 +0100)
committerPetr Menšík <pemensik@redhat.com>
Thu, 24 Jan 2019 12:09:21 +0000 (13:09 +0100)
When multilabel name is already cached, child_of_zone fails check when
zone_name is direct child of name. Error is ignored and crashes on
expectation child_name was initialized. Handle the error and relax the
check.

Reproducer:
dig isc.org
dig +sigchase +topdown isc.org

bin/dig/dighost.c

index caf1a48f0461a3994f92869824311d8ecc4526fb..3cd4ac3e712543cb682037cfea6f3e2b2a6a6a40 100644 (file)
@@ -5381,7 +5381,7 @@ child_of_zone(dns_name_t * name, dns_name_t * zone_name,
 
        name_reln = dns_name_fullcompare(name, zone_name, &orderp, &nlabelsp);
        if (name_reln != dns_namereln_subdomain ||
-           dns_name_countlabels(name) <= dns_name_countlabels(zone_name) + 1) {
+           dns_name_countlabels(name) < dns_name_countlabels(zone_name) + 1) {
                printf("\n;; ERROR : ");
                dns_name_print(name, stdout);
                printf(" is not a subdomain of: ");
@@ -5973,6 +5973,8 @@ sigchase_td(dns_message_t *msg)
                        dns_name_init(&tmp_name, NULL);
                        result = child_of_zone(&chase_name, &chase_current_name,
                                               &tmp_name);
+                       if (result != ISC_R_SUCCESS)
+                               goto cleanandgo;
                        if (dns_name_dynamic(&chase_authority_name))
                                free_name(&chase_authority_name);
                        dup_name(&tmp_name, &chase_authority_name);