From: Remi Gacogne Date: Fri, 23 Jan 2026 12:05:35 +0000 (+0100) Subject: dnsdist: Fix possible use-after-free in structured logging X-Git-Tag: rec-5.4.0-beta1~5^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7071b275f3882e3e2c467aa4bf281991ee5d327f;p=thirdparty%2Fpdns.git dnsdist: Fix possible use-after-free in structured logging SL keeps a reference to objects passed to it until it decides to actually generate the log content, so we should not pass temporaries to it. Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-dnsquestion.cc b/pdns/dnsdistdist/dnsdist-dnsquestion.cc index 21b2521082..4347ecff45 100644 --- a/pdns/dnsdistdist/dnsdist-dnsquestion.cc +++ b/pdns/dnsdistdist/dnsdist-dnsquestion.cc @@ -76,7 +76,7 @@ std::shared_ptr DNSResponse::getThisLogger(std::shared_ptr= sizeof(dnsheader)) { const auto header = getHeader(); - logger = logger->withValues("dns.response.rcode", Logging::Loggable(RCode::to_s(header->rcode))); + logger = logger->withValues("dns.response.rcode", Logging::Loggable(header->rcode)); } if (d_downstream) { logger = logger->withValues("backend.protocol", Logging::Loggable(d_downstream->getProtocol()), "backend.name", Logging::Loggable(d_downstream->getName()), "backend.address", Logging::Loggable(d_downstream->d_config.remote));