Skip to content

Commit

Permalink
[FAB-14475] fix data race in gossip/channel
Browse files Browse the repository at this point in the history
In gossip/channel.GenerateMAC()
create a new slice instead of maybe appending to existing slice

Change-Id: I2e88b87d88ddccf5e3c45471cc07656acd7e7af6
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
(cherry picked from commit 435d4c4)
  • Loading branch information
HagarMeir committed Mar 5, 2019
1 parent 36e401e commit c448a50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gossip/gossip/channel/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,8 @@ func (cache *stateInfoCache) Stop() {
// and a channel name
func GenerateMAC(pkiID common.PKIidType, channelID common.ChainID) []byte {
// Hash is computed on (PKI-ID || channel ID)
preImage := append([]byte(pkiID), []byte(channelID)...)
var preImage []byte
preImage = append(preImage, []byte(pkiID)...)
preImage = append(preImage, []byte(channelID)...)
return common_utils.ComputeSHA256(preImage)
}

0 comments on commit c448a50

Please sign in to comment.