Skip to content

Commit 5c0954a

Browse files
0xmountaintopfjl
authored andcommitted
p2p/discv5: make idx bounds checking more sound (#17571)
1 parent 62e9489 commit 5c0954a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎p2p/discv5/net.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ func (net *Network) checkTopicRegister(data *topicRegister) (*pong, error) {
12281228
if rlpHash(data.Topics) != pongpkt.data.(*pong).TopicHash {
12291229
return nil, errors.New("topic hash mismatch")
12301230
}
1231-
if int(data.Idx) < 0 || int(data.Idx) >= len(data.Topics) {
1231+
if data.Idx >= uint(len(data.Topics)) {
12321232
return nil, errors.New("topic index out of range")
12331233
}
12341234
return pongpkt.data.(*pong), nil

0 commit comments

Comments
 (0)