[php-src] PR #25986: Fix GH-25954: dns_get_mx() parses MX exchange past the record RDATA

From: Date: Tue, 01 Dec 2026 01:42:07 +0000
Subject: [php-src] PR #25986: Fix GH-25954: dns_get_mx() parses MX exchange past the record RDATA
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41301@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25986 Author: lazerg dns_get_mx() expanded the MX exchange with dn_expand() bounded by the end of the whole message, not the end of the record's RDATA. An exchange name with no terminating label ran on into the next record, so its owner name ended up in $hosts. The fixed RR header and the preference were also read without checking that they fit in the reply. The exchange is now expanded up to the end of the RDATA, and the header, RDLENGTH and preference are checked against the reply length. A malformed MX record makes dns_get_mx() return false, the same as when dn_expand() already failed. Tested in a debian container against the crafted UDP server from the issue; a well-formed reply with compressed exchange names still returns the same result. No .phpt, since the BIND-based tests in ext/standard/tests/dns cannot serve a malformed record. Fixes #25954

« previous php.git-pulls (#41301) next »