Skip to content

Commit

Permalink
Merge pull request #14878 from rgacogne/ddist19-backport-14768
Browse files Browse the repository at this point in the history
dnsdist-1.9.x: Backport of #14768 - setTicketsKeyAddedHook: pass a std::string to the hook to avoid luawrapper to truncate content at potential null chars
  • Loading branch information
rgacogne authored Nov 26, 2024
2 parents 7f9bf45 + c54b86a commit 905654a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pdns/dnsdistdist/dnsdist-lua-hooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace dnsdist::lua::hooks
{
using MaintenanceCallback = std::function<void()>;
using TicketsKeyAddedHook = std::function<void(const char*, size_t)>;
using TicketsKeyAddedHook = std::function<void(const std::string&, size_t)>;

static LockGuarded<std::vector<MaintenanceCallback>> s_maintenanceHooks;

Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 905654a

Please sign in to comment.