Skip to content

Commit

Permalink
[FAB-8575] Missing nil check in VSCCValidateTx
Browse files Browse the repository at this point in the history
There is a missing nil check in the function VSCCValidateTx in case
the header extension's ChaincodeId is nil.

I added a nil check for that, and for the ChaincodeAction too

Change-Id: I00e183cccf14ba8d6078b40db095f5225234a11d
Signed-off-by: yacovm <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Feb 28, 2018
1 parent ebe5a68 commit f4e3130
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/committer/txvalidator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,15 @@ func (v *vsccValidatorImpl) VSCCValidateTx(payload *common.Payload, envBytes []b
}
}

// Verify the header extension and response payload contain the ChaincodeId
if hdrExt.ChaincodeId == nil {
return errors.New("nil ChaincodeId in header extension"), peer.TxValidationCode_INVALID_OTHER_REASON
}

if respPayload.ChaincodeId == nil {
return errors.New("nil ChaincodeId in ChaincodeAction"), peer.TxValidationCode_INVALID_OTHER_REASON
}

// get name and version of the cc we invoked
ccID := hdrExt.ChaincodeId.Name
ccVer := respPayload.ChaincodeId.Version
Expand Down

0 comments on commit f4e3130

Please sign in to comment.