]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Pei/Hob/Hob.c
Update HobLib and Hob Service to avoid data over flow.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Hob / Hob.c
index 682fa781cdcb17c7ce0420cc322b205736ce9d2c..e0ee8e7f10621cbaccec0f3a0afbcb5f7bca8f36 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This module provide Hand-Off Block manupulation.\r
   \r
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<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
@@ -89,6 +89,12 @@ PeiCreateHob (
 \r
   HandOffHob = *Hob;\r
 \r
+  //\r
+  // Check Length to avoid data overflow. \r
+  //\r
+  if (0x10000 - Length <= 0x7) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
   Length     = (UINT16)((Length + 0x7) & (~0x7));\r
 \r
   FreeMemory = HandOffHob->EfiFreeMemoryTop -\r