]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeHstiLib/HstiDxe.c
MdePkg/Hsti: Fix a memory allocation check issue.
[mirror_edk2.git] / MdePkg / Library / DxeHstiLib / HstiDxe.c
index d5d75749874382c7f82dd657e67a299408cfa259..c032a98647bf2b0cf443d8a5876d947275325030 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
@@ -297,7 +297,7 @@ HstiLibSetTable (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   HstiAip->Hsti = AllocateCopyPool (HstiSize, Hsti);\r
-  if (HstiAip == NULL) {\r
+  if (HstiAip->Hsti == NULL) {\r
     FreePool (HstiAip);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r