]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Fix #4221 drill -x crashes with malformed IPv4
authorWillem Toorop <willem@nlnetlabs.nl>
Thu, 17 Jan 2019 10:39:06 +0000 (11:39 +0100)
committerWillem Toorop <willem@nlnetlabs.nl>
Thu, 17 Jan 2019 10:39:06 +0000 (11:39 +0100)
Thanks Oleksandr Tymoshenko

Changelog
drill/drill.c

index 7b229712d89876de82f3afeafd40fd19bdeffe75..682314487176a899e5a63a3c68094c81de8554df 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,6 @@
 1.7.1  ????-??-??
+       * bugfix #4221: drill -x crashes with malformed IPv4 address 
+         Tahnks Oleksandr Tymoshenko
        * bugfix #3437: CDS & CDNSKEY RRsets should be signed with the KSK
          Thanks Tony Finch
        * bugfix #1566, #1568, #1569, #1570: Potential NULL Dereferences
index 3a9482b3863336753913443a666d7563684569ee..d66ee862c541ab20d93ca827903d24a27f870b6b 100644 (file)
@@ -787,15 +787,17 @@ main(int argc, char *argv[])
                                qname = ldns_dname_new_frm_str(ip6_arpa_str);
                        } else {
                                qname = ldns_dname_new_frm_str(name);
-                               qname_tmp = ldns_dname_reverse(qname);
-                               ldns_rdf_deep_free(qname);
-                               qname = qname_tmp;
-                               qname_tmp = ldns_dname_new_frm_str("in-addr.arpa.");
-                               status = ldns_dname_cat(qname, qname_tmp);
-                               if (status != LDNS_STATUS_OK) {
-                                       error("%s", "could not create reverse address for ip4: %s\n", ldns_get_errorstr_by_id(status));
+                               if (qname) {
+                                       qname_tmp = ldns_dname_reverse(qname);
+                                       ldns_rdf_deep_free(qname);
+                                       qname = qname_tmp;
+                                       qname_tmp = ldns_dname_new_frm_str("in-addr.arpa.");
+                                       status = ldns_dname_cat(qname, qname_tmp);
+                                       if (status != LDNS_STATUS_OK) {
+                                               error("%s", "could not create reverse address for ip4: %s\n", ldns_get_errorstr_by_id(status));
+                                       }
+                                       ldns_rdf_deep_free(qname_tmp);
                                }
-                               ldns_rdf_deep_free(qname_tmp);
                        }
                        if (!qname) {
                                error("%s", "-x implies an ip address");