Fix panic caused by using range over slice len #1357
1 changed files with 1 additions and 1 deletions
|
@ -169,7 +169,7 @@ func (s *Server) getContainerNodes(contID cid.ID) ([]netmap.NodeInfo, error) {
|
|||
|
||||
nodes := placement.FlattenNodes(ns)
|
||||
bs := (*keys.PublicKey)(&s.key.PublicKey).Bytes()
|
||||
for i := range len(nodes) {
|
||||
for i := 0; i < len(nodes); i++ { // don't use range, slice mutates in body
|
||||
if bytes.Equal(nodes[i].PublicKey(), bs) {
|
||||
copy(nodes[i:], nodes[i+1:])
|
||||
nodes = nodes[:len(nodes)-1]
|
||||
|
|
Loading…
Reference in a new issue