mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fixes a panic in the DNS resolver
Under certain conditions it appears that the DNS response and returned error can be nil. When this happens, checking resp.Truncated results in a nil panic so we must first check that the response is not nil before checking if a truncated response was received. See moby/moby#40715 Signed-off-by: Sam Whited <sam@samwhited.com>
This commit is contained in:
parent
c485bbf754
commit
1e02aae252
1 changed files with 1 additions and 1 deletions
|
@ -484,7 +484,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
||||||
resp, err = co.ReadMsg()
|
resp, err = co.ReadMsg()
|
||||||
// Truncated DNS replies should be sent to the client so that the
|
// Truncated DNS replies should be sent to the client so that the
|
||||||
// client can retry over TCP
|
// client can retry over TCP
|
||||||
if err != nil && !resp.Truncated {
|
if err != nil && (resp != nil && !resp.Truncated) {
|
||||||
r.forwardQueryEnd()
|
r.forwardQueryEnd()
|
||||||
logrus.Debugf("[resolver] read from DNS server failed, %s", err)
|
logrus.Debugf("[resolver] read from DNS server failed, %s", err)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Reference in a new issue