summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-09-20 20:53:31 +0800
committerHao Wu <hao.a.wu@intel.com>2016-11-08 16:36:09 +0800
commit2ff3293d7bdf32c5e7ab8728f2caa464e33eda0d (patch)
treeaf515603c66df7da4defb714dd069b8937644cbb /BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
parente7700cedd924be16d226e7175998856291e0f9e0 (diff)
downloadedk2-2ff3293d7bdf32c5e7ab8728f2caa464e33eda0d.tar.gz
edk2-2ff3293d7bdf32c5e7ab8728f2caa464e33eda0d.tar.bz2
edk2-2ff3293d7bdf32c5e7ab8728f2caa464e33eda0d.zip
BaseTools/C/Common: Avoid possible NULL pointer dereference
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/C/Common/FirmwareVolumeBuffer.c')
-rw-r--r--BaseTools/Source/C/Common/FirmwareVolumeBuffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
index 7988d8e43a..a287fe1597 100644
--- a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
+++ b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
@@ -1,7 +1,7 @@
/** @file
EFI Firmware Volume routines which work on a Fv image in buffers.
-Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -353,6 +353,9 @@ Returns:
if (*DestinationFv == NULL) {
*DestinationFv = CommonLibBinderAllocate (size);
+ if (*DestinationFv == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
}
CommonLibBinderCopyMem (*DestinationFv, SourceFv, size);