The patch is a bug fix for TestFrameworkPkg/Support/TestProfile
driver. AsciiStrCpy() function was used to copy overlapping
strings, which triggered an ASSERT().

The function was used on overlapping strings in a couple of places:
1. _alltrim(): AsciiStrCpy() is replaced with CopyMem(), which can
   handle overlapping buffers.
2. _prosessLine(): AsciiStrCpy() at the beginning of the function
   is removed. The call was redundant. The function was trying to
   move the data that have already been moved by _alltrim().

Cc: Andrew Fish <[email protected]>
Cc: Michael Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Felix Polyudov <[email protected]>
---
 TestFrameworkPkg/Support/TestProfile/TestProfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.c 
b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
index f02e9dfef..2476c5740 100644
--- a/TestFrameworkPkg/Support/TestProfile/TestProfile.c
+++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
@@ -269,7 +269,7 @@ Routine Description:
   }
 
   tmp[Index] = '\0';
-  AsciiStrCpy (ptrStr, tmp);
+  CopyMem(ptrStr, tmp, Index + 1);
 
   return ptrStr;
 }
@@ -419,7 +419,7 @@ Routine Description:
   CHAR8 ptrValue[MAX_STRING_LEN + 1];
   INI   *ptrItem;
 
-  AsciiStrCpy (ptrLine, _alltrim (ptrLine));
+  _alltrim (ptrLine);
 
   if (*ptrLine == '#') {
     // it's a comment line
-- 
2.13.1.windows.2

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to