diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-02-04 19:41:30 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-02-04 19:41:30 +0100 |
commit | 5c6ab3075e8fbf8fea7fbb5249189a0216400c41 (patch) | |
tree | 61b666475a6abc2317f413b94ef0b5026e86b917 /libpod | |
parent | 4e1bcf30f3a519490f58d66bc0aef16676f61ae8 (diff) | |
download | podman-5c6ab3075e8fbf8fea7fbb5249189a0216400c41.tar.gz podman-5c6ab3075e8fbf8fea7fbb5249189a0216400c41.tar.bz2 podman-5c6ab3075e8fbf8fea7fbb5249189a0216400c41.zip |
Fix podman network disconnect wrong NetworkStatus number
The allocated `tmpNetworkStatus` must be allocated with the length 0.
Otherwise append would add new elements to the end of the slice and
not at the beginning of the allocated memory.
This caused inspect to fail since the number of networks did not
matched the number of network statuses.
Fixes #9234
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/networking_linux.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 01e4102d1..55d338e7d 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -1180,7 +1180,7 @@ func (c *Container) NetworkDisconnect(nameOrID, netName string, force bool) erro // update network status if container is not running networkStatus := c.state.NetworkStatus // clip out the index of the network - tmpNetworkStatus := make([]*cnitypes.Result, len(networkStatus)-1) + tmpNetworkStatus := make([]*cnitypes.Result, 0, len(networkStatus)-1) for k, v := range networkStatus { if index != k { tmpNetworkStatus = append(tmpNetworkStatus, v) |