X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FPei%2FHob%2FHob.c;fp=MdeModulePkg%2FCore%2FPei%2FHob%2FHob.c;h=e0ee8e7f10621cbaccec0f3a0afbcb5f7bca8f36;hp=682fa781cdcb17c7ce0420cc322b205736ce9d2c;hb=e94728b359f4e20da7fdef88a1d5123327557655;hpb=192764dba9cb61621619cbfbcbfc49834079b8f8
diff --git a/MdeModulePkg/Core/Pei/Hob/Hob.c b/MdeModulePkg/Core/Pei/Hob/Hob.c
index 682fa781cd..e0ee8e7f10 100644
--- a/MdeModulePkg/Core/Pei/Hob/Hob.c
+++ b/MdeModulePkg/Core/Pei/Hob/Hob.c
@@ -1,7 +1,7 @@
/** @file
This module provide Hand-Off Block manupulation.
-Copyright (c) 2006, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
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
@@ -89,6 +89,12 @@ PeiCreateHob (
HandOffHob = *Hob;
+ //
+ // Check Length to avoid data overflow.
+ //
+ if (0x10000 - Length <= 0x7) {
+ return EFI_INVALID_PARAMETER;
+ }
Length = (UINT16)((Length + 0x7) & (~0x7));
FreeMemory = HandOffHob->EfiFreeMemoryTop -