Commit 5c0954af authored by HAOYUatHZ's avatar HAOYUatHZ Committed by Felix Lange

p2p/discv5: make idx bounds checking more sound (#17571)

parent 62e94895
......@@ -1228,7 +1228,7 @@ func (net *Network) checkTopicRegister(data *topicRegister) (*pong, error) {
if rlpHash(data.Topics) != pongpkt.data.(*pong).TopicHash {
return nil, errors.New("topic hash mismatch")
}
if int(data.Idx) < 0 || int(data.Idx) >= len(data.Topics) {
if data.Idx >= uint(len(data.Topics)) {
return nil, errors.New("topic index out of range")
}
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