From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.92.5.61]) by mx.groups.io with SMTP id smtpd.web12.2562.1590024554213904668 for ; Wed, 20 May 2020 18:29:14 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=sVce1poR; spf=pass (domain: outlook.com, ip: 40.92.5.61, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SVcH/XGuD0K88C/8XCnj5lTAXnSG2pjxJtxcme9x2rF2VLS0vTDGHwIFMxVOO7uHJqcwQjiy8wBeCMMQ9SzAU0Tk/PyK84QKbZz0CXxwLqTzc9ljU/ogrttR4d68NsZ54Vg3XDBAYPAa3Ep4s8TkLttYFWSlKXZKGWrTRGqfHHTSX1CY6irYpbuio/VzChUMI+vapJSBy3Clmcm+lhxiAyv5nU39j2nLfLmg2ySRCYrp60fEczpr3EAyl23dFaHcfpGr9EPbl5B4UEw3JleFbn+0HAy6BdXxX9BDUQtgT0KQeEpryXUdvpQQ6bxQNn3WnSPZy/WgHL7bA+hOVeNxkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XdBEclpSEjUTB5IfLAIDm1VgUU3/N6wq3D0Oq4rq1O8=; b=aKR6yc1zZW8zLbER0m0nM/GMBtsc31WhODSuPHcyQOw/lGKqioFzwY2l2wHTEY0+FfeP6azeOFHzbSuoZEjBupjee8HIxcmip1mrNQt5/cJwMHv/g6EH7KRfVwob27JjWCrDB+Ti6AHYd9raPkrFKfvrduSMmGQH3llHE9xakd1A1XCSyYCWwcgNqZLPlhBSJRvuyCeLmCjUzSbmyblVunI9HySS236qy8ZFZ6qteEgqrTQHKiyWMWtsobYpZ9LtjObG057NFqhYzna1Ye2mj4Ihj6OdvgPr7a/8fDPK+Tjkyydph4PiWJQxnBtdHgfSUd2+qmpfZXnvb4Ck6/e0NQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XdBEclpSEjUTB5IfLAIDm1VgUU3/N6wq3D0Oq4rq1O8=; b=sVce1poRS7NDcAoczhQlIVBTXjk3HWNuZyGDXPkRV/c0I+sWGGjoB9xQ06OtuCRYpx6RNDqrXLwabULIyt7zLel7Wy08vvp5SUXUk/rqcNpwAVZ17SptN5hqwq2yYJ7ZVSPFMy7wtGmHPcPm2yl8IshR/NC2xPADWipHlAqpXUmMfH3QRv+LD265P5qA6oZZBkW2qZTWDamJdcnEvQzTlM+UYTe6aEX9CV+33E3rTgIjyi796MYHyoHzeLQ4dJ+139R+F/7gL/rVa4ilCcCYkJ31m1cPXRtJ+8OvoeQYjlvzZVp4KQOAIPkL/0S6cxxITuSZPNq54YpEfswCf+Im4w== Received: from CY1NAM02FT007.eop-nam02.prod.protection.outlook.com (10.152.74.51) by CY1NAM02HT008.eop-nam02.prod.protection.outlook.com (10.152.74.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 01:29:13 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:7e45::45) by CY1NAM02FT007.mail.protection.outlook.com (2a01:111:e400:7e45::261) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 01:29:13 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:A4559A694F8FE14959B864CFBDB0C66B9CC8894AF441A5E2F124407C0578A1E6;UpperCasedChecksum:AE10D892AFF5A8A85F90FF565925C4B40F2B3763BFF633F85B98E66032976E65;SizeAsReceived:7749;Count:48 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::bcc9:271b:20db:52e3]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::bcc9:271b:20db:52e3%6]) with mapi id 15.20.3021.020; Thu, 21 May 2020 01:29:13 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io CC: Bret Barkelew , Sean Brogan , Liming Gao , Michael D Kinney Subject: [PATCH v1 1/1] UnitTestFrameworkPkg/UnitTestResultReportLib: Use AsciiStrnCpyS() Date: Wed, 20 May 2020 18:28:40 -0700 Message-ID: X-Mailer: git-send-email 2.16.3.windows.1 X-ClientProxiedBy: CO1PR15CA0105.namprd15.prod.outlook.com (2603:10b6:101:21::25) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200521012840.17308-1-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:f:e465:9e8d:5e78:d51b) by CO1PR15CA0105.namprd15.prod.outlook.com (2603:10b6:101:21::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 01:29:12 +0000 X-Mailer: git-send-email 2.16.3.windows.1 X-Microsoft-Original-Message-ID: <20200521012840.17308-1-michael.kubacki@outlook.com> X-TMN: [c9sWoRtXEmv2E+Us3WlbpxTCnIyyodoOiuob7za2EtioFAvl9eySirRAqyzKmR6/] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e6bc12d9-b90a-46bd-4394-08d7fd265e0b X-MS-TrafficTypeDiagnostic: CY1NAM02HT008: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EjuEMqegbhRlrD7fSu9wbzPzBbbSij8kB57sXmwocw7+PopbxoePO1l1sqpSTEwtgQ7e2L2MJVioHluHplVkqg0jfoW0SBAdLkXlKyqL3ZK52VqQxTFaxns1BFaakWcJ6EzY1GMGjb18bU3RyPrqo0dm26IonVMKhctV5L0z2nuZrQGatvoj2OnZoKgqbMuRuDA5eEV09+KYA37M8/is8WJJ8DlY/J8uSGnr8GpZt4woKYg17AZhTSAc+xk76pA0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR07MB3440.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: jbbkN5H5KSrRPs+1m3iL07SBPHxDJCQs6sbW38kv/HFTSL7OvgwYB1e+BXRTzZHe2xmvVK0V2B83Ttgzq9R2IGjuZtVV/FRj4XmmT95ifDoCXOCeXvn/KrPWRB9UwWm3zOW15Zeecm18SsyIP+yjkAcBjiTEQRRj53Bo47Et/Bh543AT89/UKK/RYDc+UMLv6NJTWsccnPhGih4voqA7nQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6bc12d9-b90a-46bd-4394-08d7fd265e0b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 01:29:12.9722 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT008 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2721 The ReportOutput() function in UnitTestResultReportLib copies characters from a function input buffer to an intermediate local buffer in fixed size chunks of the maximum size of the intermediate buffer. The implementation currently calls AsciiStrCpyS() which will ASSERT on an error. This commit changes the call to AsciiStrnCpyS() to avoid the ASSERT which is not expected in the usage of the string copy in this implementation. Cc: Bret Barkelew Cc: Sean Brogan Cc: Liming Gao Cc: Michael D Kinney Signed-off-by: Michael Kubacki --- UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportL= ibConOut.c | 2 +- UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportL= ibDebugLib.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestR= esultReportLibConOut.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportL= ib/UnitTestResultReportLibConOut.c index 139360ee1657..cfb0c5972bd1 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibConOut.c +++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibConOut.c @@ -42,7 +42,7 @@ ReportOutput ( =20 Length =3D AsciiStrLen (Output); for (Index =3D 0; Index < Length; Index +=3D (sizeof (AsciiString) - 1))= { - AsciiStrCpyS (AsciiString, sizeof (AsciiString), &Output[Index]); + AsciiStrnCpyS (AsciiString, sizeof (AsciiString), &Output[Index], size= of (AsciiString) - 1); ReportPrint ("%a", AsciiString); } } diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestR= esultReportLibDebugLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultRepor= tLib/UnitTestResultReportLibDebugLib.c index 743aad2958a7..1402d0ef83e2 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibDebugLib.c +++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibDebugLib.c @@ -41,7 +41,7 @@ ReportOutput ( =20 Length =3D AsciiStrLen (Output); for (Index =3D 0; Index < Length; Index +=3D (sizeof (AsciiString) - 1))= { - AsciiStrCpyS (AsciiString, sizeof (AsciiString), &Output[Index]); + AsciiStrnCpyS (AsciiString, sizeof (AsciiString), &Output[Index], size= of (AsciiString) - 1); DEBUG ((DEBUG_INFO, AsciiString)); } } --=20 2.16.3.windows.1