From cb42da5323f66cf6fed15947a5a3af43edb24ffe Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 7 Dec 2023 16:37:24 +0100 Subject: [PATCH] rec: Fix a dangling reference in Lua's UDP Query Response callback Introduced in 50bd111e3c78e2cc8c2aa916a1f9fc22699f1f60 --- pdns/recursordist/lua-recursor4.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdns/recursordist/lua-recursor4.cc b/pdns/recursordist/lua-recursor4.cc index fc08701f3d..0a381b2b89 100644 --- a/pdns/recursordist/lua-recursor4.cc +++ b/pdns/recursordist/lua-recursor4.cc @@ -746,7 +746,7 @@ bool RecursorLua4::genhook(const luacall_t& func, DNSQuestion& dq, int& ret) con PacketBuffer p = GenUDPQueryResponse(dq.udpQueryDest, dq.udpQuery); dq.udpAnswer = std::string(reinterpret_cast(p.data()), p.size()); // coverity[auto_causes_copy] not copying produces a dangling ref - const auto cbFunc = d_lw->readVariable&>(dq.udpCallback).get_value_or(nullptr); + const auto cbFunc = d_lw->readVariable>(dq.udpCallback).get_value_or(nullptr); if (!cbFunc) { SLOG(g_log << Logger::Error << "Attempted callback for Lua UDP Query/Response which could not be found" << endl, g_slog->withName("lua")->info(Logr::Error, "Attempted callback for Lua UDP Query/Response which could not be found")); -- 2.47.2