summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiDpLib
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-06-30 03:18:31 +0000
committershenshushi <shenshushi@Edk2>2015-06-30 03:18:31 +0000
commite75390f02971bcd4d67a9696508050bee4936a01 (patch)
tree10fc0928560c01484d1952adf3a5990cc2243c26 /ShellPkg/Library/UefiDpLib
parentcb9a7ebabcd6b8a49dc0854b2f9592d732b5afbd (diff)
downloadedk2-platforms-e75390f02971bcd4d67a9696508050bee4936a01.tar.xz
ShellPkg: 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: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17730 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiDpLib')
-rw-r--r--ShellPkg/Library/UefiDpLib/DpUtilities.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ShellPkg/Library/UefiDpLib/DpUtilities.c b/ShellPkg/Library/UefiDpLib/DpUtilities.c
index ef204ffef1..7290285e23 100644
--- a/ShellPkg/Library/UefiDpLib/DpUtilities.c
+++ b/ShellPkg/Library/UefiDpLib/DpUtilities.c
@@ -1,7 +1,7 @@
/** @file
Utility functions used by the Dp application.
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -141,10 +141,10 @@ GetShortPdbFileName (
UINTN StartIndex;
UINTN EndIndex;
- ZeroMem (UnicodeBuffer, DXE_PERFORMANCE_STRING_LENGTH * sizeof (CHAR16));
+ ZeroMem (UnicodeBuffer, (DP_GAUGE_STRING_LENGTH + 1) * sizeof (CHAR16));
if (PdbFileName == NULL) {
- StrnCpy (UnicodeBuffer, L" ", 1);
+ StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1);
} else {
StartIndex = 0;
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
@@ -261,7 +261,7 @@ GetNameFromHandle (
);
if (!EFI_ERROR (Status)) {
SHELL_FREE_NON_NULL (PlatformLanguage);
- StrnCpy (mGaugeString, StringPtr, DP_GAUGE_STRING_LENGTH);
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr);
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
return;
}
@@ -305,7 +305,7 @@ GetNameFromHandle (
//
// Method 3. Get the name string from FFS UI section
//
- StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, NameString);
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
FreePool (NameString);
} else {
@@ -321,7 +321,7 @@ GetNameFromHandle (
//
NameString = ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);
if (NameString != NULL) {
- StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, NameString);
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
FreePool (NameString);
return;
@@ -334,7 +334,7 @@ GetNameFromHandle (
//
StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL);
ASSERT (StringPtr != NULL);
- StrnCpy (mGaugeString, StringPtr, DP_GAUGE_STRING_LENGTH);
+ StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr);
FreePool (StringPtr);
}