whisper: Allocate the full topic length in the copy

This is so that the partial topic code (currently disabled) does
not crash when trying to access byte #3,
This commit is contained in:
Guillaume Ballet 2018-03-27 16:04:03 +02:00
parent 563643e66f
commit 0fb9691705

View file

@ -560,7 +560,7 @@ func (api *PublicWhisperAPI) NewMessageFilter(req Criteria) (string, error) {
if len(req.Topics) > 0 { if len(req.Topics) > 0 {
topics = make([][]byte, len(req.Topics)) topics = make([][]byte, len(req.Topics))
for i, topic := range req.Topics { for i, topic := range req.Topics {
topics[i] = make([]byte, len(topic)) topics[i] = make([]byte, TopicLength)
copy(topics[i], topic[:]) copy(topics[i], topic[:])
} }
} }