mirror of https://github.com/acidanthera/audk.git
PerformancePkg Dp_App: Use safe string functions
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17745 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
274e843356
commit
ecd58a2511
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Utility functions used by the Dp application.
|
Utility functions used by the Dp application.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -159,7 +159,7 @@ GetShortPdbFileName (
|
||||||
ZeroMem (UnicodeBuffer, DXE_PERFORMANCE_STRING_LENGTH * sizeof (CHAR16));
|
ZeroMem (UnicodeBuffer, DXE_PERFORMANCE_STRING_LENGTH * sizeof (CHAR16));
|
||||||
|
|
||||||
if (PdbFileName == NULL) {
|
if (PdbFileName == NULL) {
|
||||||
StrCpy (UnicodeBuffer, L" ");
|
StrCpyS (UnicodeBuffer, DXE_PERFORMANCE_STRING_SIZE, L" ");
|
||||||
} else {
|
} else {
|
||||||
StartIndex = 0;
|
StartIndex = 0;
|
||||||
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
|
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
|
||||||
|
@ -290,8 +290,11 @@ GetNameFromHandle (
|
||||||
);
|
);
|
||||||
SafeFreePool (BestLanguage);
|
SafeFreePool (BestLanguage);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
StrnCpy (mGaugeString, StringPtr, DP_GAUGE_STRING_LENGTH);
|
StrCpyS (
|
||||||
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
|
mGaugeString,
|
||||||
|
DP_GAUGE_STRING_LENGTH + 1,
|
||||||
|
StringPtr
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,8 +337,11 @@ GetNameFromHandle (
|
||||||
//
|
//
|
||||||
// Method 3. Get the name string from FFS UI section
|
// Method 3. Get the name string from FFS UI section
|
||||||
//
|
//
|
||||||
StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
|
StrCpyS (
|
||||||
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
|
mGaugeString,
|
||||||
|
DP_GAUGE_STRING_LENGTH + 1,
|
||||||
|
NameString
|
||||||
|
);
|
||||||
FreePool (NameString);
|
FreePool (NameString);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
|
@ -350,8 +356,11 @@ GetNameFromHandle (
|
||||||
//
|
//
|
||||||
NameString = ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);
|
NameString = ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);
|
||||||
if (NameString != NULL) {
|
if (NameString != NULL) {
|
||||||
StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
|
StrCpyS (
|
||||||
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
|
mGaugeString,
|
||||||
|
DP_GAUGE_STRING_LENGTH + 1,
|
||||||
|
NameString
|
||||||
|
);
|
||||||
FreePool (NameString);
|
FreePool (NameString);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +372,7 @@ GetNameFromHandle (
|
||||||
//
|
//
|
||||||
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL);
|
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL);
|
||||||
ASSERT (StringPtr != NULL);
|
ASSERT (StringPtr != NULL);
|
||||||
StrCpy (mGaugeString, StringPtr);
|
StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr);
|
||||||
FreePool (StringPtr);
|
FreePool (StringPtr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue