Add sanity checking for modified svcMap while iterating through it.
Suggestion from @DerZade Fixes https://github.com/moby/moby/pull/43444#discussion_r1033364679 Fixes #43442 Signed-off-by: Martin Ashby <martin@ashbysoft.com>
This commit is contained in:
parent
465ec963c8
commit
349c515ef8
1 changed files with 7 additions and 1 deletions
|
@ -2001,7 +2001,13 @@ func (n *network) ResolveName(req string, ipType int) ([]net.IP, bool) {
|
|||
strings.HasSuffix(req, strings.TrimPrefix(key, "*"))) {
|
||||
selectedKey = key
|
||||
ok = true
|
||||
ipSet, _ = sr.svcMap.Get(selectedKey)
|
||||
var found bool
|
||||
ipSet, found = sr.svcMap.Get(selectedKey)
|
||||
if !found {
|
||||
logrus.Errorf("svcMap changed unexpectedly looking for key %s", key)
|
||||
continue
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue