mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
2561f56540
commit
bcd7070d86
|
@ -263,7 +263,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;
|
||||
|
@ -301,7 +301,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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue