From bcd7070d86066ac788366d81e08e9b65d6db330a Mon Sep 17 00:00:00 2001 From: eric_tian Date: Wed, 3 Jun 2009 08:48:09 +0000 Subject: fix the issue of Inadequate Memory Allocation in Variable Services In UpdateVariableInfo(), the code incorrectly allocate a small memory, whose size equate with the number of Unicode name. Should change it to be equal to the byte length of this Unicode name. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8457 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MdeModulePkg/Universal/Variable/RuntimeDxe') diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 02f146895f..aadda4b587 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -176,7 +176,7 @@ UpdateVariableInfo ( ASSERT (gVariableInfo != NULL); CopyGuid (&gVariableInfo->VendorGuid, VendorGuid); - gVariableInfo->Name = AllocatePool (StrLen (VariableName)); + gVariableInfo->Name = AllocatePool (StrSize (VariableName)); ASSERT (gVariableInfo->Name != NULL); StrCpy (gVariableInfo->Name, VariableName); gVariableInfo->Volatile = Volatile; @@ -214,7 +214,7 @@ UpdateVariableInfo ( ASSERT (Entry->Next != NULL); CopyGuid (&Entry->Next->VendorGuid, VendorGuid); - Entry->Next->Name = AllocatePool (StrLen (VariableName)); + Entry->Next->Name = AllocatePool (StrSize (VariableName)); ASSERT (Entry->Next->Name != NULL); StrCpy (Entry->Next->Name, VariableName); Entry->Next->Volatile = Volatile; -- cgit v1.2.3