From d68da99d1a2637e4fbc7532641e488b0e393c860 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 1 Apr 2022 15:16:10 +0200 Subject: [PATCH] Throw an exception on trying to get an address out of a non-A/AAAA record. Better that the nullptr deref it was before. --- pdns/dnsrecords.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index c6afdac811..be749b7a8f 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -994,7 +994,7 @@ ComboAddress getAddr(const DNSRecord& dr, uint16_t defport) else if (auto aaaa = getRR(dr)) { return aaaa->getCA(defport); } - return ComboAddress(); + throw std::invalid_argument("not an A or AAAA record"); } /** -- 2.47.2