From fd8a2786d47c946f0b956003a3b7a037f7322757 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Fri, 23 Mar 2018 16:35:50 +0100 Subject: [PATCH] whisper: fix issue in topic list copy Fixes #16271. What was appeneded was a pointer to an object that changes during the iteration. --- whisper/whisperv6/api.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/whisper/whisperv6/api.go b/whisper/whisperv6/api.go index 96e2b17e7c..74b8873d10 100644 --- a/whisper/whisperv6/api.go +++ b/whisper/whisperv6/api.go @@ -558,9 +558,10 @@ func (api *PublicWhisperAPI) NewMessageFilter(req Criteria) (string, error) { } if len(req.Topics) > 0 { - topics = make([][]byte, 0, len(req.Topics)) - for _, topic := range req.Topics { - topics = append(topics, topic[:]) + topics = make([][]byte, len(req.Topics)) + for i, topic := range req.Topics { + topics = append(topics, make([]byte, 0, len(topic))) + copy(topics[i], topic[:]) } }