From c4571f04794154d405a69b79babfd74bcf9fc63a Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Fri, 28 Mar 2014 02:50:47 +0000 Subject: Add check to avoid null pointer deference. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Reviewed-by: Eric Dong git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15410 6f19259b-4bc3-4df7-8a09-765794883524 --- IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c') diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c index 4ea30bdf7d..7b3f2050ae 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c @@ -217,6 +217,9 @@ BdsLibRegisterNewOption ( UINT16 BootOrderEntry; UINTN OrderItemNum; + if (DevicePath == NULL) { + return EFI_INVALID_PARAMETER; + } OptionPtr = NULL; OptionSize = 0; @@ -1551,7 +1554,9 @@ SetVariableAndReportStatusCodeOnError ( SetVariableStatus->SetStatus = Status; SetVariableStatus->Attributes = Attributes; CopyMem (SetVariableStatus + 1, VariableName, NameSize); - CopyMem (((UINT8 *) (SetVariableStatus + 1)) + NameSize, Data, DataSize); + if ((Data != NULL) && (DataSize != 0)) { + CopyMem (((UINT8 *) (SetVariableStatus + 1)) + NameSize, Data, DataSize); + } REPORT_STATUS_CODE_EX ( EFI_ERROR_CODE, -- cgit v1.2.3