From: Charles-Henri Bruyand Date: Sat, 12 Oct 2024 19:10:36 +0000 (+0200) Subject: dnsdist setTicketsKeyAddedHook: pass a std::string to the hook to avoid luawrapper... X-Git-Tag: rec-5.2.0-alpha1~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F14768%2Fhead;p=thirdparty%2Fpdns.git dnsdist setTicketsKeyAddedHook: pass a std::string to the hook to avoid luawrapper to truncate content at potential null chars --- diff --git a/pdns/dnsdistdist/dnsdist-lua-hooks.cc b/pdns/dnsdistdist/dnsdist-lua-hooks.cc index 2904cd3792..8bdff2e17c 100644 --- a/pdns/dnsdistdist/dnsdist-lua-hooks.cc +++ b/pdns/dnsdistdist/dnsdist-lua-hooks.cc @@ -7,7 +7,7 @@ namespace dnsdist::lua::hooks { using MaintenanceCallback = std::function; -using TicketsKeyAddedHook = std::function; +using TicketsKeyAddedHook = std::function; static LockGuarded> s_maintenanceHooks; @@ -35,7 +35,7 @@ static void setTicketsKeyAddedHook(const LuaContext& context, const TicketsKeyAd TLSCtx::setTicketsKeyAddedHook([hook](const std::string& key) { try { auto lua = g_lua.lock(); - hook(key.c_str(), key.size()); + hook(key, key.size()); } catch (const std::exception& exp) { warnlog("Error calling the Lua hook after new tickets key has been added: %s", exp.what());