]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Fix a dangling reference in Lua's UDP Query Response callback 13587/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 7 Dec 2023 15:37:24 +0000 (16:37 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 7 Dec 2023 15:37:24 +0000 (16:37 +0100)
Introduced in 50bd111e3c78e2cc8c2aa916a1f9fc22699f1f60

pdns/recursordist/lua-recursor4.cc

index fc08701f3d44cae13eea749e496abf10fb47a571..0a381b2b890b406168cba35f5ecbe36d3f0f6567 100644 (file)
@@ -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<const char*>(p.data()), p.size());
         // coverity[auto_causes_copy] not copying produces a dangling ref
-        const auto cbFunc = d_lw->readVariable<boost::optional<luacall_t>&>(dq.udpCallback).get_value_or(nullptr);
+        const auto cbFunc = d_lw->readVariable<boost::optional<luacall_t>>(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"));