From 734b6c33ba6ec210eef3642e07479a5b9d445ef1 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Tue, 8 Apr 2014 18:05:48 +0000 Subject: ArmPlatformPkg/Bds: Check OptionalData is not NULL before accessing it Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15439 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/Bds/BdsInternal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ArmPlatformPkg/Bds/BdsInternal.h') diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h index 033805b49c..ad593bbea6 100644 --- a/ArmPlatformPkg/Bds/BdsInternal.h +++ b/ArmPlatformPkg/Bds/BdsInternal.h @@ -39,7 +39,10 @@ #define ARM_BDS_OPTIONAL_DATA_SIGNATURE SIGNATURE_32('a', 'b', 'o', 'd') -#define IS_ARM_BDS_BOOTENTRY(ptr) (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) == ARM_BDS_OPTIONAL_DATA_SIGNATURE) +#define IS_ARM_BDS_BOOTENTRY(ptr) \ + (((ptr)->OptionalData != NULL) && \ + (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) \ + == ARM_BDS_OPTIONAL_DATA_SIGNATURE)) #define UPDATE_BOOT_ENTRY L"Update entry: " #define DELETE_BOOT_ENTRY L"Delete entry: " -- cgit v1.2.3