]> git.proxmox.com Git - mirror_edk2.git/commitdiff
FmpDevicePkg/FmpDxe: Fix uninitialized pointer dereference
authorKun Qin <kuqin@microsoft.com>
Wed, 18 Mar 2020 06:12:27 +0000 (14:12 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 6 May 2020 03:04:17 +0000 (03:04 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2602

Zero the allocated buffer in case GetImageInfo `continue` in the middle of
a loop. This will cause unexpected GetImageInfo failure not clearing the
corresponding entry and lead to GP faults when dereferencing this entry.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
FmpDevicePkg/FmpDxe/Dependency.c

index 8f97c429162e29e0e89d934bcbd08a6e6420d597..65c23989c65f9610bb66802967e35da2df684038 100644 (file)
@@ -552,7 +552,7 @@ EvaluateImageDependencies (
     return EFI_ABORTED;\r
   }\r
 \r
-  mFmpImageInfoBuf = AllocatePool (sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR *) * mNumberOfFmpInstance);\r
+  mFmpImageInfoBuf = AllocateZeroPool (sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR *) * mNumberOfFmpInstance);\r
   if (mFmpImageInfoBuf == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r