From 33826bd14919f70d83475bee69f87af3705998f6 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Tue, 6 Feb 2024 12:08:30 +0100 Subject: [PATCH] code review from otto, thanks --- pdns/lua-record.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; }); -- 2.47.2