Skip to content

Commit

Permalink
whisper: fix issue in topic list copy
Browse files Browse the repository at this point in the history
Fixes ethereum#16271. What was appeneded was a pointer to
an object that changes during the iteration.
  • Loading branch information
gballet committed Mar 26, 2018
1 parent 85ea915 commit fd8a278
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions whisper/whisperv6/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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[:])
}
}

Expand Down

0 comments on commit fd8a278

Please sign in to comment.