From fbf7b936f4347b9e0d398adb8e41a47d2b4a1497 Mon Sep 17 00:00:00 2001 From: Parameswaran Selvam Date: Wed, 18 Aug 2021 14:18:10 +0000 Subject: [PATCH] FAB18529 added nil check in channel header parsing Fuzz testing has reported SEGV while sending incomplete/null message request to orderer. Signed-off-by: Parameswaran Selvam (cherry picked from commit 540fff8b8eed15113bf4e65df43c7a63a644bb37) --- protoutil/commonutils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/protoutil/commonutils.go b/protoutil/commonutils.go index 4b4874682fd..76c903cdbd9 100644 --- a/protoutil/commonutils.go +++ b/protoutil/commonutils.go @@ -212,6 +212,10 @@ func IsConfigBlock(block *cb.Block) bool { // ChannelHeader returns the *cb.ChannelHeader for a given *cb.Envelope. func ChannelHeader(env *cb.Envelope) (*cb.ChannelHeader, error) { + if env == nil { + return nil, errors.New("Invalid envelope payload. can't be nil") + } + envPayload, err := UnmarshalPayload(env.Payload) if err != nil { return nil, err