mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix crash if the len was < maxSetStringLen
If the len was less than the max length, there was a panic Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
This commit is contained in:
parent
5bbc19d7fe
commit
1f55734d4c
1 changed files with 8 additions and 2 deletions
|
@ -287,7 +287,10 @@ func (c *controller) addServiceBinding(svcName, svcID, nID, eID, containerName s
|
|||
ok, entries := s.assignIPToEndpoint(ip.String(), eID)
|
||||
if !ok || entries > 1 {
|
||||
setStr, b := s.printIPToEndpoint(ip.String())
|
||||
logrus.Warnf("addServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr[:maxSetStringLen])
|
||||
if len(setStr) > maxSetStringLen {
|
||||
setStr = setStr[:maxSetStringLen]
|
||||
}
|
||||
logrus.Warnf("addServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr)
|
||||
}
|
||||
|
||||
// Add loadbalancer service and backend in all sandboxes in
|
||||
|
@ -355,7 +358,10 @@ func (c *controller) rmServiceBinding(svcName, svcID, nID, eID, containerName st
|
|||
ok, entries := s.removeIPToEndpoint(ip.String(), eID)
|
||||
if !ok || entries > 0 {
|
||||
setStr, b := s.printIPToEndpoint(ip.String())
|
||||
logrus.Warnf("rmServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr[:maxSetStringLen])
|
||||
if len(setStr) > maxSetStringLen {
|
||||
setStr = setStr[:maxSetStringLen]
|
||||
}
|
||||
logrus.Warnf("rmServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr)
|
||||
}
|
||||
|
||||
// Remove loadbalancer service(if needed) and backend in all
|
||||
|
|
Loading…
Reference in a new issue