Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
p2p/discv5: fix idx can be negative after uint convert to int(can cau…
Browse files Browse the repository at this point in the history
…se crash) (#1307)
  • Loading branch information
yahtoo authored and Paladz committed Aug 31, 2018
1 parent 69b3d4c commit 1ac3c8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion p2p/discover/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ func (net *Network) checkTopicRegister(data *topicRegister) (*pong, error) {
if hash != pongpkt.data.(*pong).TopicHash {
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 pongpkt.data.(*pong), nil
Expand Down

0 comments on commit 1ac3c8a

Please sign in to comment.