Skip to content

fix(dns): validate address record lengths - #452

Open
fhgffy wants to merge 1 commit into
nadoo:mainfrom
fhgffy:fix/dns-address-record-length
Open

fhgffy wants to merge 1 commit into
nadoo:mainfrom
fhgffy:fix/dns-address-record-length

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 13, 2026

Copy link
Copy Markdown

Check that A and AAAA records contain exactly 4 and 16 bytes of RDATA before decoding an address. Short records currently cause a slice bounds panic (or consume bytes beyond the record when the buffer has spare capacity), while oversized records are silently accepted.

Reject invalid address record lengths and retain the existing decoding for valid records. Regression cases pass complete DNS responses through UnmarshalMessage, including valid A/AAAA records, short records, and oversized records.

Validation (Go 1.27.2, Windows/amd64): go test -p 1 ./... -count=1, go vet -p 1 ./..., and go build -p 1 ./....

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