]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsheader_aligned: Prevent copies 16503/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 14 Nov 2025 09:37:33 +0000 (10:37 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 14 Nov 2025 09:40:03 +0000 (10:40 +0100)
commit778d6694eb0fa78e6bf4cad12f6047118873753a
treee6d9ce4748ef38ec7ace735eeeed0d656f9b0674
parentb1521115a1c8fb90b58ca60a018ccb85b4c96b77
dnsheader_aligned: Prevent copies

The `dnsheader_aligned` object contains a pointer that references
either the `dnsheader` passed to the constructor if it is properly
aligned, or the internal `dnsheader` member. In the second case,
making a copy would mean we can reference an object that has been
destructed, which is a serious problem.

This commit also ensures copy elision is done `DNSQuestion:getHeader`,
as otherwise the compiler might refuse to compile.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dns.hh
pdns/dnsdistdist/dnsdist.hh