SignedCapsulePkg: Address NULL pointer dereference case.

Original code GetFmpImageDescriptors for OriginalFmpImageInfoBuf
pointer, if failed, return a NULL pointer. The OriginalFmpImageInfoBuf
should not be NULL and the NULL pointer dereference case
should be false positive.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Signed-off-by: Vin Xue <vinxue@outlook.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Vin Xue 2020-07-14 10:09:35 +08:00 committed by mergify[bot]
parent 1da651cdb7
commit 21a23e6966
1 changed files with 21 additions and 18 deletions

View File

@ -681,8 +681,10 @@ FindMatchingFmpHandles (
// //
// Loop through the set of EFI_FIRMWARE_IMAGE_DESCRIPTORs. // Loop through the set of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
// //
FmpImageInfoBuf = OriginalFmpImageInfoBuf;
MatchFound = FALSE; MatchFound = FALSE;
if (OriginalFmpImageInfoBuf != NULL) {
FmpImageInfoBuf = OriginalFmpImageInfoBuf;
for (Index2 = 0; Index2 < FmpImageInfoCount; Index2++) { for (Index2 = 0; Index2 < FmpImageInfoCount; Index2++) {
for (Index3 = 0; Index3 < mSystemFmpPrivate->DescriptorCount; Index3++) { for (Index3 = 0; Index3 < mSystemFmpPrivate->DescriptorCount; Index3++) {
MatchFound = CompareGuid ( MatchFound = CompareGuid (
@ -708,6 +710,7 @@ FindMatchingFmpHandles (
FreePool (OriginalFmpImageInfoBuf); FreePool (OriginalFmpImageInfoBuf);
} }
}
if ((*HandleCount) == 0) { if ((*HandleCount) == 0) {
// //