MdeModulePkg/HiiDatabaseDxe: Fix BlockSize length

The BlockSize calculation was missing the 0 terminator which caused the
string block to shrink by 1 every time the string was processed.
Therefore causing memory corruptions, because the string took more
memory space as was allocated for the string block therefore corrupting
the memory pool at the end (which caused an ASSERT upon trying to free
it).

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
This commit is contained in:
Maximilian Brune 2024-05-16 15:50:41 +02:00 committed by Liming Gao
parent b3a2f7ff24
commit 5ea30a061c
1 changed files with 1 additions and 1 deletions

View File

@ -1000,7 +1000,7 @@ SetStringWorker (
case EFI_HII_SIBT_STRING_SCSU_FONT:
case EFI_HII_SIBT_STRINGS_SCSU:
case EFI_HII_SIBT_STRINGS_SCSU_FONT:
BlockSize = OldBlockSize + StrLen (String);
BlockSize = OldBlockSize + StrSize (String);
BlockSize -= AsciiStrSize ((CHAR8 *)StringTextPtr);
Block = AllocateZeroPool (BlockSize);
if (Block == NULL) {