Skip to content

keep buflen in sync in dns_process address copy path - #13558

Open
dxbjavid wants to merge 1 commit into
apache:masterfrom
dxbjavid:dns-buflen-sync
Open

keep buflen in sync in dns_process address copy path#13558
dxbjavid wants to merge 1 commit into
apache:masterfrom
dxbjavid:dns-buflen-sync

Conversation

@dxbjavid

Copy link
Copy Markdown
Contributor

dns_process copies each answer record into the fixed HostEnt hostbuf while keeping a running buflen for the space left at the write cursor, but the branch that memcpys an A/AAAA address when the source is not word aligned advances the cursor by the alignment padding and the record length without decrementing buflen. Since every later name expansion hands that same buflen to dn_expand as its output limit, the stale, over-large value lets a crafted response (a large address record followed by a record whose owner name expands near the end of hostbuf) write the expanded name past the buffer and into the adjacent srv_hosts vector. This restores buflen from the cursor after the copy so it stays consistent, matching what the name, CNAME and PTR paths already do.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant