aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv6/filter.go
diff options
context:
space:
mode:
authorb00ris <b00ris@mail.ru>2018-01-26 19:41:53 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-01-26 19:41:53 +0800
commit2ef3815af41c7a12dd798416b4a5ae74c09706c8 (patch)
treedbddf454c44306cdf6f223f155c7ae7e08f0b32d /whisper/whisperv6/filter.go
parent4dd0727c393fcade1a6835db2f753f0a365ed073 (diff)
downloadgo-tangerine-2ef3815af41c7a12dd798416b4a5ae74c09706c8.tar
go-tangerine-2ef3815af41c7a12dd798416b4a5ae74c09706c8.tar.gz
go-tangerine-2ef3815af41c7a12dd798416b4a5ae74c09706c8.tar.bz2
go-tangerine-2ef3815af41c7a12dd798416b4a5ae74c09706c8.tar.lz
go-tangerine-2ef3815af41c7a12dd798416b4a5ae74c09706c8.tar.xz
go-tangerine-2ef3815af41c7a12dd798416b4a5ae74c09706c8.tar.zst
go-tangerine-2ef3815af41c7a12dd798416b4a5ae74c09706c8.zip
whisper: fix empty topic (#15811)
* whisper: fix empty topic * whisper: add check to matchSingleTopic * whisper: add tests * whisper: fix gosimple * whisper: added lastTopicByte const
Diffstat (limited to 'whisper/whisperv6/filter.go')
-rw-r--r--whisper/whisperv6/filter.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/whisper/whisperv6/filter.go b/whisper/whisperv6/filter.go
index 2f52dd6b9..a752c7ac9 100644
--- a/whisper/whisperv6/filter.go
+++ b/whisper/whisperv6/filter.go
@@ -221,8 +221,12 @@ func (f *Filter) MatchTopic(topic TopicType) bool {
}
func matchSingleTopic(topic TopicType, bt []byte) bool {
- if len(bt) > 4 {
- bt = bt[:4]
+ if len(bt) > TopicLength {
+ bt = bt[:TopicLength]
+ }
+
+ if len(bt) < TopicLength {
+ return false
}
for j, b := range bt {