diff options
author | Ian Lance Taylor <iant@golang.org> | 2024-04-11 14:36:25 -0700 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-04-11 22:24:41 +0000 |
commit | ddfab21e464b9b4c15fe3dc97eb5d93a4932f434 (patch) | |
tree | 699080d6591abf3f4ab9c9c094ce64f5cb337a60 /src/net | |
parent | bfb1f563716f513b1c58883c7217f468c53a0f1a (diff) | |
download | go-ddfab21e464b9b4c15fe3dc97eb5d93a4932f434.tar.gz go-ddfab21e464b9b4c15fe3dc97eb5d93a4932f434.zip |
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>
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/dnsclient_unix.go | 4 |
1 files changed, 3 insertions, 1 deletions
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 + } } } |