From: Remi Gacogne Date: Thu, 7 Dec 2023 15:37:24 +0000 (+0100) Subject: rec: Fix a dangling reference in Lua's UDP Query Response callback X-Git-Tag: dnsdist-1.9.0-alpha4~18^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F13587%2Fhead;p=thirdparty%2Fpdns.git rec: Fix a dangling reference in Lua's UDP Query Response callback Introduced in 50bd111e3c78e2cc8c2aa916a1f9fc22699f1f60 --- 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"));