[php-src] PR #25984: [PHP-8.4] Fix GH-25968: dns_get_record() reads A record bytes past a short RDATA
| From: | lazerg | Date: | Tue, 01 Dec 2026 01:40:28 +0000 |
| Subject: | [php-src] PR #25984: [PHP-8.4] Fix GH-25968: dns_get_record() reads A record bytes past a short RDATA | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41299@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25984
Author: lazerg
For an A record,
php_parserr() only checked that 4 bytes were left in the whole
message, not in the record itself. With an RDLENGTH below 4, the missing bytes came from the next
record, so dns_get_record() returned a made-up address like 9.192.12.0. A
short A record is now treated as malformed, the same way other bad RDATA already goes to
fail.
CHECKCP(dlen) already runs before the switch, so dlen >= 4 also keeps
the read inside the message. I checked it with the reporter's fake DNS server in a container:
before the fix the result has the bogus record, after it the malformed reply gives an empty result,
and well-formed replies are unchanged. No .phpt, since the suite has no resolver mock.
Fixes #25968