Skip to content

Commit

Permalink
p2p/discv5: make idx bounds checking more sound (ethereum#17571)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmountaintop authored and fjl committed Sep 3, 2018
1 parent 62e9489 commit 5c0954a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion p2p/discv5/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c0954a

Please sign in to comment.