Skip to content

check cp bounds before reading A6 partial short in php_parserr#22201

Open
alhudz wants to merge 1 commit into
php:masterfrom
alhudz:dns-a6-partial-short-bounds
Open

check cp bounds before reading A6 partial short in php_parserr#22201
alhudz wants to merge 1 commit into
php:masterfrom
alhudz:dns-a6-partial-short-bounds

Conversation

@alhudz

@alhudz alhudz commented Jun 1, 2026

Copy link
Copy Markdown

Noticed the A6 branch in php_parserr reads cp[0] for the partial short without the CHECKCP guard every other field read in this function uses. With a 1-byte A6 rdata whose masklen % 16 is 9..15, cp already sits at end, so that byte is read past the response data and lands in the ipv6 string. Guard it like the surrounding reads.

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, should this be backported to 8.4?

@alhudz

alhudz commented Jun 15, 2026

Copy link
Copy Markdown
Author

Yeah, the same unguarded cp[0] read is in 8.4 (it's actually identical back through 8.3 and in 8.5 too), so it should be backported. The surrounding A6 block matches, so the one-line CHECKCP(1) cherry-picks cleanly onto those branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants