Commit 83405759 authored by libotony's avatar libotony Committed by Péter Szilágyi

p2p/discv5: fix negative index after uint convert to int (#17274)

parent abbb2199
...@@ -1228,7 +1228,7 @@ func (net *Network) checkTopicRegister(data *topicRegister) (*pong, error) { ...@@ -1228,7 +1228,7 @@ func (net *Network) checkTopicRegister(data *topicRegister) (*pong, error) {
if rlpHash(data.Topics) != pongpkt.data.(*pong).TopicHash { if rlpHash(data.Topics) != pongpkt.data.(*pong).TopicHash {
return nil, errors.New("topic hash mismatch") return nil, errors.New("topic hash mismatch")
} }
if data.Idx < 0 || int(data.Idx) >= len(data.Topics) { if int(data.Idx) < 0 || int(data.Idx) >= len(data.Topics) {
return nil, errors.New("topic index out of range") return nil, errors.New("topic index out of range")
} }
return pongpkt.data.(*pong), nil return pongpkt.data.(*pong), nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment