Skip to content

Commit ddfab21

Browse files
ianlancetaylorgopherbot
authored andcommitted
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Commit-Queue: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent bfb1f56 commit ddfab21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/net/dnsclient_unix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ func extractExtendedRCode(p dnsmessage.Parser, hdr dnsmessage.Header) (dnsmessag
277277
if ahdr.Type == dnsmessage.TypeOPT {
278278
return ahdr.ExtendedRCode(hdr.RCode), hasAdd
279279
}
280-
p.SkipAdditional()
280+
if err := p.SkipAdditional(); err != nil {
281+
return hdr.RCode, hasAdd
282+
}
281283
}
282284
}
283285

0 commit comments

Comments
 (0)