From: Ian Lance Taylor Date: Thu, 11 Apr 2024 21:36:25 +0000 (-0700) Subject: net: check SkipAdditional error result X-Git-Tag: go1.23rc1~640 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ddfab21e464b9b4c15fe3dc97eb5d93a4932f434;p=gostls13.git 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 LUCI-TryBot-Result: Go LUCI Commit-Queue: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor --- diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go index e9e7e4df15..ad5c245dbf 100644 --- a/src/net/dnsclient_unix.go +++ b/src/net/dnsclient_unix.go @@ -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 + } } }