Skip to content

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

Merged
bryancall merged 1 commit into
apache:masterfrom
dxbjavid:dns-buflen-sync
Sep 4, 2026
Merged

keep buflen in sync in dns_process address copy path#13558
bryancall merged 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.

@bryancall
bryancall self-requested a review August 24, 2026 22:36
@bryancall bryancall added this to the 11.0.0 milestone Aug 24, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Ready to Merge in 9.2.x Branch and Release Sep 3, 2026
@bryancall
bryancall merged commit 80e89e5 into apache:master Sep 4, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this to For v10.2.1 in ATS v10.2.x Sep 4, 2026
@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x Sep 4, 2026
@dxbjavid

dxbjavid commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Thank you, much appreciated

cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Sep 9, 2026
…e#13558)

When decoding a DNS response, the path that copies an unaligned A or AAAA
record into the host entry buffer moved the write position without updating
the count of space remaining, so the two disagreed for the rest of the
response. Update the count after the copy, the same way the name, CNAME and
PTR paths already do.

(cherry picked from commit 80e89e5)
@cmcfarlen cmcfarlen moved this from For v10.2.1 to Picked v10.2.1 in ATS v10.2.x Sep 9, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.1 Sep 9, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to the 10.2.x branch as b880bea for the 10.2.1 release.

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

Projects

Status: Ready to Merge
Status: For v10.1.1
Status: Picked v10.2.1

Development

Successfully merging this pull request may close these issues.

4 participants