]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg Variable: Fix a corner case issue about setting a variable
authorcinnamon shia <cinnamon.shia@hpe.com>
Fri, 11 May 2018 15:21:11 +0000 (23:21 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 14 May 2018 02:04:50 +0000 (10:04 +0800)
Fix the issue that failed to update or add a UEFI variable if the remaining size is equal to the data size
of the variable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>
Signed-off-by: Ansen Huang <ansen.huang@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c

index 6caf603b3d305f41b43c45c966a6957a014bff31..7303681aaa293adc801d6ac45694b84e19c731a1 100644 (file)
@@ -17,7 +17,7 @@
   integer overflow. It should also check attribute to avoid authentication bypass.\r
 \r
 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -288,7 +288,7 @@ UpdateVariableStore (
       DataPtr += mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase;\r
     }\r
 \r
-    if ((DataPtr + DataSize) >= ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) FwVolHeader + FwVolHeader->FvLength))) {\r
+    if ((DataPtr + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) FwVolHeader + FwVolHeader->FvLength))) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
   } else {\r
@@ -301,7 +301,7 @@ UpdateVariableStore (
       DataPtr += mVariableModuleGlobal->VariableGlobal.VolatileVariableBase;\r
     }\r
 \r
-    if ((DataPtr + DataSize) >= ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size))) {\r
+    if ((DataPtr + DataSize) > ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size))) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r