From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D83A021DFC87C for ; Mon, 14 Aug 2017 20:54:56 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 14 Aug 2017 20:57:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,376,1498546800"; d="scan'208";a="140268905" Received: from mdkinney-mobl1.amr.corp.intel.com ([10.241.98.166]) by fmsmga006.fm.intel.com with ESMTP; 14 Aug 2017 20:57:20 -0700 From: Michael D Kinney To: edk2-devel@lists.01.org Cc: Andrew Fish , Michael Kinney , Felix Polyudov Date: Mon, 14 Aug 2017 20:57:18 -0700 Message-Id: <20170815035718.1560-3-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.13.1.windows.2 In-Reply-To: <20170815035718.1560-1-michael.d.kinney@intel.com> References: <20170815035718.1560-1-michael.d.kinney@intel.com> Subject: [edk2-staging/edk2-test Patch V2 2/2] TestFrameworkPkg/TestProfile: Fix overlapping buffer ASSERT() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 03:54:57 -0000 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 Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Felix Polyudov --- 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