Update UnitTestLib and UnitTestBootUsbMicrosoftLib to use
safe string functions from the BaseLib and PrintLib.
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
MsUnitTestPkg/Library/UnitTestBootUsbMicrosoftLib/UnitTestBootUsb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MsUnitTestPkg/Library/UnitTestBootUsbMicrosoftLib/UnitTestBootUsb.c b/MsUnitTestPkg/Library/UnitTestBootUsbMicrosoftLib/UnitTestBootUsb.c
index 85f5ee5a0e..677d3edb0a 100644
--- a/MsUnitTestPkg/Library/UnitTestBootUsbMicrosoftLib/UnitTestBootUsb.c
+++ b/MsUnitTestPkg/Library/UnitTestBootUsbMicrosoftLib/UnitTestBootUsb.c
@@ -46,7 +46,7 @@ SetUsbBootNext (
UINTN OptionBufferSize = 0, VariableSize = 0;
BOOLEAN IsUsbOptionFound = FALSE;
- StrCpy(BootOptionName, L"Boot000");
+ StrCpyS(BootOptionName, sizeof (BootOptionName) / sizeof (BootOptionName[0]), L"Boot000");
BootOptionIndexChar = BootOptionName + StrLen(BootOptionName);
//
@@ -56,7 +56,7 @@ SetUsbBootNext (
{
// Construct the BootOption name for this boot option.
// Do this by altering the last character of the name.
- UnicodeValueToString(BootOptionIndexChar, 0, (INT64)BootOptionIndex, 1);
+ UnicodeValueToStringS(BootOptionIndexChar, sizeof (BootOptionName) / sizeof (BootOptionName[0]) - StrLen(BootOptionName), 0, (INT64)BootOptionIndex, 1);
// Attempt to retrieve the option.
DEBUG(( DEBUG_VERBOSE, __FUNCTION__" - Checking for %s...\n", BootOptionName ));
--
2.14.2.windows.3
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel