]> Cypherpunks repositories - gostls13.git/commitdiff
net: check SkipAdditional error result
authorIan Lance Taylor <iant@golang.org>
Thu, 11 Apr 2024 21:36:25 +0000 (14:36 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 11 Apr 2024 22:24:41 +0000 (22:24 +0000)
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>
src/net/dnsclient_unix.go

index e9e7e4df151f973b76d98b21323df2c0fe4b4c35..ad5c245dbf74b3167f723381bd87b9d6f9f5bd66 100644 (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
+               }
        }
 }