diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2015-07-01 08:03:50 +0000 |
---|---|---|
committer | shenshushi <shenshushi@Edk2> | 2015-07-01 08:03:50 +0000 |
commit | d89deb3d7ec0f41af85abe5e0bd7403ecf2809fa (patch) | |
tree | 53cbf089d4acdf1f8c45a1ce999b1f1429bd5bf4 | |
parent | f83f808ca4c427b369dd28129e85495d89b28938 (diff) | |
download | edk2-platforms-d89deb3d7ec0f41af85abe5e0bd7403ecf2809fa.tar.xz |
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
-rw-r--r-- | MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c index 6304b7fc6c..b425af17c2 100644 --- a/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c +++ b/MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c @@ -121,10 +121,10 @@ GetShortPdbFileName ( UINTN StartIndex;
UINTN EndIndex;
- ZeroMem (UnicodeBuffer, PROFILE_NAME_STRING_LENGTH * sizeof (CHAR16));
+ ZeroMem (UnicodeBuffer, (PROFILE_NAME_STRING_LENGTH + 1) * sizeof (CHAR16));
if (PdbFileName == NULL) {
- StrnCpy (UnicodeBuffer, L" ", 1);
+ StrnCpyS (UnicodeBuffer, PROFILE_NAME_STRING_LENGTH + 1, L" ", 1);
} else {
StartIndex = 0;
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++);
@@ -201,7 +201,7 @@ GetDriverNameString ( //
// 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;
FreePool (NameString);
return;
|