1
0
mirror of https://github.com/golang/go synced 2024-11-15 02:20:32 -07:00

net: check SkipAdditional error result

This will avoid a potential endless loop for a corrupt DNS packet.

For #66754

Change-Id: I46591b3f7695bcc88d2312833e45955f8c129d2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/578375
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Ian Lance Taylor 2024-04-11 14:36:25 -07:00 committed by Gopher Robot
parent bfb1f56371
commit ddfab21e46

View File

@ -277,7 +277,9 @@ func extractExtendedRCode(p dnsmessage.Parser, hdr dnsmessage.Header) (dnsmessag
if ahdr.Type == dnsmessage.TypeOPT {
return ahdr.ExtendedRCode(hdr.RCode), hasAdd
}
p.SkipAdditional()
if err := p.SkipAdditional(); err != nil {
return hdr.RCode, hasAdd
}
}
}