From: Peter van Dijk Date: Tue, 6 Feb 2024 11:08:30 +0000 (+0100) Subject: code review from otto, thanks X-Git-Tag: dnsdist-1.9.0~13^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33826bd14919f70d83475bee69f87af3705998f6;p=thirdparty%2Fpdns.git code review from otto, thanks --- diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index 920c0ccf4c..f774b19034 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -508,7 +508,6 @@ static bool getAuth(const DNSName& name, uint16_t qtype, SOAData* soaData) { static LockGuarded s_ub; - vector ret; { auto ueback = s_ub.lock(); return ueback->getAuth(name, qtype, soaData); @@ -1122,6 +1121,9 @@ static void setupLuaRecords(LuaContext& lua) try { rec = DNSName(record); qtype = type; + if (qtype.getCode() == 0) { + throw std::invalid_argument("unknown type"); + } } catch (const std::exception& e) { g_log << Logger::Error << "DB lookup cannot be performed, the name (" << record << ") or type (" << type << ") is malformed: " << e.what() << endl; @@ -1140,7 +1142,7 @@ static void setupLuaRecords(LuaContext& lua) } } catch (std::exception& e) { - g_log << Logger::Error << "Failed to do DB lookup for " << rec << "/" << type << ": " << e.what() << endl; + g_log << Logger::Error << "Failed to do DB lookup for " << rec << "/" << qtype << ": " << e.what() << endl; } return ret; });