diff options
author | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-06-03 08:48:09 +0000 |
---|---|---|
committer | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-06-03 08:48:09 +0000 |
commit | bcd7070d86066ac788366d81e08e9b65d6db330a (patch) | |
tree | 0edc176bcc6ca7dac82c04a5404e80e8b21a8d41 /MdeModulePkg | |
parent | 2561f5654062a6b36f006400e20f508073f91f36 (diff) | |
download | edk2-bcd7070d86066ac788366d81e08e9b65d6db330a.tar.gz edk2-bcd7070d86066ac788366d81e08e9b65d6db330a.tar.bz2 edk2-bcd7070d86066ac788366d81e08e9b65d6db330a.zip |
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
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 4 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c index cbf953dfe9..dddc143751 100644 --- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c +++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c @@ -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;
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;
|