good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 20797348 authored by Péter Szilágyi's avatar Péter Szilágyi
Browse files

p2p/discover: fix out-of-bounds issue

parent 88f2839d
No related branches found
No related tags found
No related merge requests found
...@@ -763,7 +763,7 @@ func (tab *Table) addReplacement(b *bucket, n *Node) { ...@@ -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
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment