mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-03 23:02:55 +00:00
p2p/discover: fix out-of-bounds issue
This commit is contained in:
parent
88f2839da4
commit
20797348ca
1 changed files with 1 additions and 1 deletions
|
|
@ -763,7 +763,7 @@ func (tab *Table) addReplacement(b *bucket, n *Node) {
|
||||||
// last entry in the bucket. If 'last' isn't the last entry, it has either been replaced
|
// last entry in the bucket. If 'last' isn't the last entry, it has either been replaced
|
||||||
// with someone else or became active.
|
// with someone else or became active.
|
||||||
func (tab *Table) replace(b *bucket, last *Node) *Node {
|
func (tab *Table) replace(b *bucket, last *Node) *Node {
|
||||||
if len(b.entries) >= 0 && b.entries[len(b.entries)-1].ID != last.ID {
|
if len(b.entries) == 0 || b.entries[len(b.entries)-1].ID != last.ID {
|
||||||
// Entry has moved, don't replace it.
|
// Entry has moved, don't replace it.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue