In the file net/dnsclient_unix.go in the function newRequest
error handling is missing after calling b.Finish(). If
the implementation of dnsmessage.Builder.Finish changes
it is theoretically possible that the missing error handling
introduces a nil pointer exception.
Fixes #50946
Change-Id: I3f0785f71def6649d6089d0af71c9e50f5ccb259
GitHub-Last-Rev:
2a2197f7e6d18d5477967b299ed734a7b224536d
GitHub-Pull-Request: golang/go#50948
Reviewed-on: https://go-review.googlesource.com/c/go/+/381966
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
}
tcpReq, err = b.Finish()
+ if err != nil {
+ return 0, nil, nil, err
+ }
udpReq = tcpReq[2:]
l := len(tcpReq) - 2
tcpReq[0] = byte(l >> 8)
tcpReq[1] = byte(l)
- return id, udpReq, tcpReq, err
+ return id, udpReq, tcpReq, nil
}
func checkResponse(reqID uint16, reqQues dnsmessage.Question, respHdr dnsmessage.Header, respQues dnsmessage.Question) bool {