p2p/discv5: fix negative index after uint convert to int (#17274)
This commit is contained in:
parent
abbb219933
commit
834057592f
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue