Skip to content

Commit

Permalink
dns/dnsmessage: document that Skip does not fully validate the header
Browse files Browse the repository at this point in the history
The Skip methods do not fully validate the name in header,
the compression pointers are not followed

Change-Id: If34a041d799a22117afac9bd23e76606f5d0c8f7
GitHub-Last-Rev: f8f2586
GitHub-Pull-Request: #196
Reviewed-on: https://go-review.googlesource.com/c/net/+/534175
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
  • Loading branch information
mateusz834 authored and gopherbot committed Oct 11, 2023
1 parent b225e7c commit 92728b3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dns/dnsmessage/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 92728b3

Please sign in to comment.