whisper: add check to matchSingleTopic

This commit is contained in:
b00ris 2018-01-05 00:16:35 +03:00
parent 3b2ff9a71d
commit 40f686b21d
No known key found for this signature in database
GPG key ID: 2F73E159EB73232C
2 changed files with 8 additions and 0 deletions

View file

@ -220,6 +220,10 @@ func matchSingleTopic(topic TopicType, bt []byte) bool {
bt = bt[:4] bt = bt[:4]
} }
if len(bt) < 4 {
return false
}
for j, b := range bt { for j, b := range bt {
if topic[j] != b { if topic[j] != b {
return false return false

View file

@ -225,6 +225,10 @@ func matchSingleTopic(topic TopicType, bt []byte) bool {
bt = bt[:4] bt = bt[:4]
} }
if len(bt) < 4 {
return false
}
for j, b := range bt { for j, b := range bt {
if topic[j] != b { if topic[j] != b {
return false return false