MdeModulePkg/Universal/Variable: Use safe string functions to refine code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17789 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Qiu Shumin
2015-07-01 08:34:22 +00:00
committed by shenshushi
parent 5e4b8bfe43
commit 568a5119a1
3 changed files with 7 additions and 7 deletions

View File

@@ -158,7 +158,7 @@ UpdateVariableInfo (
CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);
gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (gVariableInfo->Name != NULL);
StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));
StrCpyS (gVariableInfo->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);
gVariableInfo->Volatile = Volatile;
}
@@ -194,7 +194,7 @@ UpdateVariableInfo (
CopyGuid (&Entry->Next->VendorGuid, VendorGuid);
Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (Entry->Next->Name != NULL);
StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));
StrCpyS (Entry->Next->Name, StrSize(VariableName)/sizeof(CHAR16), VariableName);
Entry->Next->Volatile = Volatile;
}
@@ -2853,7 +2853,7 @@ VariableLockRequestToLock (
}
Name = (CHAR16 *) ((UINTN) Entry + sizeof (*Entry));
StrnCpy (Name, VariableName, StrLen (VariableName));
StrCpyS (Name, StrSize (VariableName)/sizeof(CHAR16), VariableName);
CopyGuid (&Entry->Guid, VendorGuid);
InsertTailList (&mLockedVariableList, &Entry->Link);