OSDN Git Service
(root)
/
bytom
/
bytom.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
69b3d4c
)
p2p/discv5: fix idx can be negative after uint convert to int(can cause crash) (...
author
yahtoo
<yahtoo.ma@gmail.com>
Fri, 31 Aug 2018 05:48:40 +0000
(13:48 +0800)
committer
Paladz
<yzhu101@uottawa.ca>
Fri, 31 Aug 2018 05:48:40 +0000
(13:48 +0800)
p2p/discover/net.go
patch
|
blob
|
history
diff --git
a/p2p/discover/net.go
b/p2p/discover/net.go
index
a6319d8
..
3645860
100644
(file)
--- a/
p2p/discover/net.go
+++ b/
p2p/discover/net.go
@@
-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