aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>2018-09-03 22:47:20 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-09-03 22:47:20 +0800
commit5c0954afffe223ea61ea42dbc74ec7dbdc3663a1 (patch)
treee54c0be3b1c2b9e697e69b5ca2b12a1d57df5331
parent62e94895da80838ec694b4ba19eeac80c9dc88c1 (diff)
downloadgo-tangerine-5c0954afffe223ea61ea42dbc74ec7dbdc3663a1.tar
go-tangerine-5c0954afffe223ea61ea42dbc74ec7dbdc3663a1.tar.gz
go-tangerine-5c0954afffe223ea61ea42dbc74ec7dbdc3663a1.tar.bz2
go-tangerine-5c0954afffe223ea61ea42dbc74ec7dbdc3663a1.tar.lz
go-tangerine-5c0954afffe223ea61ea42dbc74ec7dbdc3663a1.tar.xz
go-tangerine-5c0954afffe223ea61ea42dbc74ec7dbdc3663a1.tar.zst
go-tangerine-5c0954afffe223ea61ea42dbc74ec7dbdc3663a1.zip
p2p/discv5: make idx bounds checking more sound (#17571)
-rw-r--r--p2p/discv5/net.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/p2p/discv5/net.go b/p2p/discv5/net.go
index b93c93d64..a6cabf080 100644
--- a/p2p/discv5/net.go
+++ b/p2p/discv5/net.go
@@ -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