It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49 to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS.
Cc: Jiewen Yao <jiewen....@intel.com> Cc: Jaben Carsey <jaben.car...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.z...@intel.com> --- ShellPkg/Library/UefiDpLib/Dp.c | 8 +++++--- ShellPkg/Library/UefiDpLib/DpTrace.c | 10 +++++----- ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c index 54fd0d1ae163..4bad3c2f72ac 100644 --- a/ShellPkg/Library/UefiDpLib/Dp.c +++ b/ShellPkg/Library/UefiDpLib/Dp.c @@ -13,7 +13,7 @@ Dp uses this information to group records in different ways. It also uses timer information to calculate elapsed time for each measurement. - Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved. + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -168,6 +168,7 @@ ShellCommandRunDp ( BOOLEAN CumulativeMode; CONST CHAR16 *CustomCumulativeToken; PERF_CUM_DATA *CustomCumulativeData; + UINTN NameSize; SHELL_STATUS ShellStatus; StringPtr = NULL; @@ -263,8 +264,9 @@ ShellCommandRunDp ( CustomCumulativeData->MaxDur = 0; CustomCumulativeData->Count = 0; CustomCumulativeData->Duration = 0; - CustomCumulativeData->Name = AllocateZeroPool (StrLen (CustomCumulativeToken) + 1); - UnicodeStrToAsciiStr (CustomCumulativeToken, CustomCumulativeData->Name); + NameSize = StrLen (CustomCumulativeToken) + 1; + CustomCumulativeData->Name = AllocateZeroPool (NameSize); + UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize); } // diff --git a/ShellPkg/Library/UefiDpLib/DpTrace.c b/ShellPkg/Library/UefiDpLib/DpTrace.c index dcb1ca500bef..f3f781fdb989 100644 --- a/ShellPkg/Library/UefiDpLib/DpTrace.c +++ b/ShellPkg/Library/UefiDpLib/DpTrace.c @@ -220,8 +220,8 @@ DumpAllTrace( ++Count; // Count the number of records printed // If Handle is non-zero, see if we can determine a name for the driver - AsciiStrToUnicodeStr (Measurement.Module, mGaugeString); // Use Module by default - AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken); + AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof (mGaugeString) / sizeof (mGaugeString[0])); // Use Module by default + AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0])); if (Measurement.Handle != NULL) { // See if the Handle is in the HandleBuffer for (TIndex = 0; TIndex < HandleCount; TIndex++) { @@ -595,7 +595,7 @@ ProcessHandles( continue; } mGaugeString[0] = 0; // Empty driver name by default - AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken); + AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0])); // See if the Handle is in the HandleBuffer for (Index = 0; Index < HandleCount; Index++) { if (Measurement.Handle == HandleBuffer[Index]) { @@ -776,8 +776,8 @@ ProcessGlobal( &Measurement.EndTimeStamp, &Measurement.Identifier)) != 0) { - AsciiStrToUnicodeStr (Measurement.Module, mGaugeString); - AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken); + AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof (mGaugeString) / sizeof (mGaugeString[0])); + AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0])); mGaugeString[25] = 0; mUnicodeToken[31] = 0; if ( ! ( IsPhase( &Measurement) || diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c index 6561270df5d9..666ee9d8ea02 100644 --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c @@ -272,6 +272,7 @@ ShellCommandRunTftp ( CONST CHAR16 *ValueStr; CONST CHAR16 *RemoteFilePath; CHAR8 *AsciiRemoteFilePath; + UINTN FilePathSize; CONST CHAR16 *Walker; CONST CHAR16 *LocalFilePath; EFI_MTFTP4_CONFIG_DATA Mtftp4ConfigData; @@ -358,14 +359,13 @@ ShellCommandRunTftp ( RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2); ASSERT(RemoteFilePath != NULL); - AsciiRemoteFilePath = AllocatePool ( - (StrLen (RemoteFilePath) + 1) * sizeof (CHAR8) - ); + FilePathSize = StrLen (RemoteFilePath) + 1; + AsciiRemoteFilePath = AllocatePool (FilePathSize); if (AsciiRemoteFilePath == NULL) { ShellStatus = SHELL_OUT_OF_RESOURCES; goto Error; } - UnicodeStrToAsciiStr (RemoteFilePath, AsciiRemoteFilePath); + UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize); if (ParamCount == 4) { LocalFilePath = ShellCommandLineGetRawValue (CheckPackage, 3); -- 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel