public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: edk2-devel@lists.01.org
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	Liming Gao <liming.gao@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: [staging/edk2-test Patch 05/10] MsUnitTestPkg/Library: Use safe string functions
Date: Tue, 19 Dec 2017 16:00:09 -0800	[thread overview]
Message-ID: <20171220000014.9140-6-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20171220000014.9140-1-michael.d.kinney@intel.com>

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



  parent reply	other threads:[~2017-12-19 23:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20  0:00 [staging/edk2-test Patch 00/10] MsUnitTestPkg: Add Unit Test Support and sample Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 01/10] " Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 02/10] MsUnitTestPkg: Update copyright and license info Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 03/10] MsUnitTestPkg: Update for VS2017 and 32-bit apps Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 04/10] MsUnitTestPkg/Include: Remove use of variadic macros Kinney, Michael D
2017-12-20  0:00 ` Kinney, Michael D [this message]
2017-12-20  0:00 ` [staging/edk2-test Patch 06/10] MsUnitTestPkg/UnitTestLib: Fix GCC build errors Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 07/10] MsUnitTestPkg/Library: Update __FUNCTION__ usage Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 08/10] MsUnitTestPkg: Add missing library classes Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 09/10] MsUnitTestPkg: Add missing DSC file Kinney, Michael D
2017-12-20  0:00 ` [staging/edk2-test Patch 10/10] MsUnitTestPkg: Fix EDK II style issues Kinney, Michael D
2018-01-18  8:10 ` [staging/edk2-test Patch 00/10] MsUnitTestPkg: Add Unit Test Support and sample Sean Brogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171220000014.9140-6-michael.d.kinney@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox