MdeModulePkg/Application/MemoryProfileInfo: 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@17777 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Qiu Shumin 2015-07-01 08:03:50 +00:00 committed by shenshushi
parent f83f808ca4
commit d89deb3d7e
1 changed files with 3 additions and 3 deletions

View File

@ -121,10 +121,10 @@ GetShortPdbFileName (
UINTN StartIndex; UINTN StartIndex;
UINTN EndIndex; UINTN EndIndex;
ZeroMem (UnicodeBuffer, PROFILE_NAME_STRING_LENGTH * sizeof (CHAR16)); ZeroMem (UnicodeBuffer, (PROFILE_NAME_STRING_LENGTH + 1) * sizeof (CHAR16));
if (PdbFileName == NULL) { if (PdbFileName == NULL) {
StrnCpy (UnicodeBuffer, L" ", 1); StrnCpyS (UnicodeBuffer, PROFILE_NAME_STRING_LENGTH + 1, L" ", 1);
} else { } else {
StartIndex = 0; StartIndex = 0;
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++); for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++);
@ -201,7 +201,7 @@ GetDriverNameString (
// //
// Method 2: Get the name string from FFS UI section // Method 2: Get the name string from FFS UI section
// //
StrnCpy (mNameString, NameString, PROFILE_NAME_STRING_LENGTH); StrCpyS (mNameString, PROFILE_NAME_STRING_LENGTH + 1, NameString);
mNameString[PROFILE_NAME_STRING_LENGTH] = 0; mNameString[PROFILE_NAME_STRING_LENGTH] = 0;
FreePool (NameString); FreePool (NameString);
return; return;