From 92728b3b3c00280fd64b9ac7641d5e81f39afc4c Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Tue, 10 Oct 2023 15:15:25 +0000 Subject: [PATCH] dns/dnsmessage: document that Skip does not fully validate the header The Skip methods do not fully validate the name in header, the compression pointers are not followed Change-Id: If34a041d799a22117afac9bd23e76606f5d0c8f7 GitHub-Last-Rev: f8f2586fb2528308f0b130c64cc7c13ca7820607 GitHub-Pull-Request: golang/net#196 Reviewed-on: https://go-review.googlesource.com/c/net/+/534175 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Reviewed-by: Damien Neil Auto-Submit: Ian Lance Taylor --- dns/dnsmessage/message.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dns/dnsmessage/message.go b/dns/dnsmessage/message.go index b6b4f9c197..42987ab7c5 100644 --- a/dns/dnsmessage/message.go +++ b/dns/dnsmessage/message.go @@ -751,6 +751,9 @@ func (p *Parser) AllAnswers() ([]Resource, error) { } // SkipAnswer skips a single Answer Resource. +// +// It does not perform a complete validation of the resource header, which means +// it may return a nil error when the [AnswerHeader] would actually return an error. func (p *Parser) SkipAnswer() error { return p.skipResource(sectionAnswers) } @@ -801,6 +804,9 @@ func (p *Parser) AllAuthorities() ([]Resource, error) { } // SkipAuthority skips a single Authority Resource. +// +// It does not perform a complete validation of the resource header, which means +// it may return a nil error when the [AuthorityHeader] would actually return an error. func (p *Parser) SkipAuthority() error { return p.skipResource(sectionAuthorities) } @@ -851,6 +857,9 @@ func (p *Parser) AllAdditionals() ([]Resource, error) { } // SkipAdditional skips a single Additional Resource. +// +// It does not perform a complete validation of the resource header, which means +// it may return a nil error when the [AdditionalHeader] would actually return an error. func (p *Parser) SkipAdditional() error { return p.skipResource(sectionAdditionals) }