Resolve buffer check overrun issue.
authorYao, Jiewen <jiewen.yao@intel.com>
Thu, 22 Jan 2015 03:29:17 +0000 (03:29 +0000)
committerjyao1 <jyao1@Edk2>
Thu, 22 Jan 2015 03:29:17 +0000 (03:29 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Qiu, Shumin" <shumin.qiu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16637 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/DxeHstiLib/HstiDxe.c

index d5d7574..114a767 100644 (file)
@@ -200,12 +200,12 @@ InternalHstiIsValidTable (
   //\r
   // Check ImplementationID\r
   //\r
-  for (Index = 0; Index < sizeof(Hsti->ImplementationID); Index++) {\r
+  for (Index = 0; Index < sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0]); Index++) {\r
     if (Hsti->ImplementationID[Index] == 0) {\r
       break;\r
     }\r
   }\r
-  if (Index == sizeof(Hsti->ImplementationID)) {\r
+  if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) {\r
     DEBUG ((EFI_D_ERROR, "ImplementationID is no NUL CHAR\n"));\r
     return FALSE;\r
   }\r