]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Fix invalid `substr()` use in the DNS overlay parser 16887/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 16 Feb 2026 11:32:43 +0000 (12:32 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 16 Feb 2026 11:36:42 +0000 (12:36 +0100)
commitcb03001b31579d9cb191552eba5012bbd2c9fd2e
tree8f78cfc22e20f52091995a32795c8dd2b683f5d4
parentad0edc82d5595f49f2ef8d026ac004d7fd88202e
dnsdist: Fix invalid `substr()` use in the DNS overlay parser

`std::basic_string_view<CharT,Traits>::substr`'s second parameter is a length,
not an iterator or a position, so the existing code was misusing it and
creating a view that potentially expanded outside of the packet.
However currently the view is never used to read more than
`record.d_contentOffset` (we are passing it immediately to `makeComboAddressFromRaw`
with `record.d_contentLength` as the length) and `record.d_contentOffset`
has been validated right before to be either `4` or `16`, so
there is no out-of-bounds read.
This issue has been introduced in b6f9a21db93ee25ec665dc5f65e87eb7adebd102 and
is not included in any stable release, so no need to backport
the fix.

Reported by Nyaz360 in YWH-PGM6095-85, thanks a lot!

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