Date: Mon, 22 Jun 2020 23:13:14 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362516 - head/contrib/ldns/drill Message-ID: <202006222313.05MNDEZm015563@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gonzo Date: Mon Jun 22 23:13:14 2020 New Revision: 362516 URL: https://svnweb.freebsd.org/changeset/base/362516 Log: Fix crash in drill(1) when IP has two subsequent dots Cherry-pick crash fix from the upstream repo PR: 226575 Reported by: Goran Mekić <meka@tilda.center> Obtained from: https://git.nlnetlabs.nl/ldns/commit/?id=98291475 MFC after: 2 weeks Modified: head/contrib/ldns/drill/drill.c Modified: head/contrib/ldns/drill/drill.c ============================================================================== --- head/contrib/ldns/drill/drill.c Mon Jun 22 22:59:03 2020 (r362515) +++ head/contrib/ldns/drill/drill.c Mon Jun 22 23:13:14 2020 (r362516) @@ -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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006222313.05MNDEZm015563>