summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/GenFv
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-10-11 10:14:22 +0800
committerHao Wu <hao.a.wu@intel.com>2016-11-08 16:36:19 +0800
commit22247021349d8835026efe9511f25503e7dbb95c (patch)
treecb576fa403a14f19eb204c13f26a11144dc094f8 /BaseTools/Source/C/GenFv
parent2cb874352423fcfd180199e6de8298567dff8e7f (diff)
downloadedk2-22247021349d8835026efe9511f25503e7dbb95c.tar.gz
edk2-22247021349d8835026efe9511f25503e7dbb95c.tar.bz2
edk2-22247021349d8835026efe9511f25503e7dbb95c.zip
BaseTools/GenFv: 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/GenFv')
-rw-r--r--BaseTools/Source/C/GenFv/GenFvInternalLib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index fab7c940e0..f7e3ba507c 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -1,7 +1,7 @@
/** @file
This file contains the internal functions required to generate a Firmware Volume.
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
Portions Copyright (c) 2016 HP Development Company, L.P.<BR>
This program and the accompanying materials
@@ -2494,6 +2494,10 @@ Returns:
// Open the FV Extension Header file
//
FvExtHeaderFile = fopen (LongFilePath (mFvDataInfo.FvExtHeaderFile), "rb");
+ if (FvExtHeaderFile == NULL) {
+ Error (NULL, 0, 0001, "Error opening file", mFvDataInfo.FvExtHeaderFile);
+ return EFI_ABORTED;
+ }
//
// Get the file size