From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: liming.gao@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Tue, 21 May 2019 22:32:09 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2019 22:32:09 -0700 X-ExtLoop1: 1 Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 21 May 2019 22:32:08 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 21 May 2019 22:32:08 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 21 May 2019 22:32:07 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.18]) with mapi id 14.03.0415.000; Wed, 22 May 2019 13:32:06 +0800 From: "Liming Gao" To: "Ni, Ray" , "devel@edk2.groups.io" , "Gao, Zhichao" CC: "Wu, Hao A" Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg/DebugLib: Fix string copy issue Thread-Topic: [edk2-devel] [PATCH] IntelFrameworkModulePkg/DebugLib: Fix string copy issue Thread-Index: AQHVD6nP1XaLPuWA6ECQNBBlN97btaZ2F0KAgACHa6A= Date: Wed, 22 May 2019 05:32:05 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E44F5DE@SHSMSX104.ccr.corp.intel.com> References: <20190521074952.38376-1-zhichao.gao@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C1577C0@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C1577C0@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDYyMDk4OGQtOGJjMS00ZWE0LTgwNjYtYjYzNjFhZGQ1YWYwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaTdJaWoya1ZWZkxFK2xNM0d1SkhFdlJEZDRCemxOVG9lQjVJenI2VTBEb3BZeHozc2NUSVR6T0dadkYzUEtQdyJ9 dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. MdeModulePkg one is correct. The issue is only in IntelFrameworkModule= Pkg one.=20 This is a regression issue. Before remove IntelFrameworkModulePkg, it is s= till required to be fixed.=20 Thanks Liming > -----Original Message----- > From: Ni, Ray > Sent: Wednesday, May 22, 2019 1:22 PM > To: devel@edk2.groups.io; Gao, Zhichao > Cc: Gao, Liming ; Wu, Hao A > Subject: RE: [edk2-devel] [PATCH] IntelFrameworkModulePkg/DebugLib: Fix = string copy issue >=20 > Can the library in MdeModulePkg be used? > The IntelFrameworkPkg/IntelFrameworkModulePkg will be removed in June. >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Gao, > > Zhichao > > Sent: Tuesday, May 21, 2019 3:50 PM > > To: devel@edk2.groups.io > > Cc: Gao, Liming ; Wu, Hao A > > Subject: [edk2-devel] [PATCH] IntelFrameworkModulePkg/DebugLib: Fix > > string copy issue > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1826 > > > > There is a bug to use AsciiStrCpyS to copy a truncated string. If woul= d cause > > an assert because the truncated length is always less than the source = string > > length. It should use the AsciiStrnCpyS instead. > > > > Cc: Liming Gao > > Cc: Hao A Wu > > Signed-off-by: Zhichao Gao > > --- > > .../Library/PeiDxeDebugLibReportStatusCode/DebugLib.c | 4 ++-= - > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git > > a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/De > > bugLib.c > > b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/De > > bugLib.c > > index e92601f89e..1840b6d683 100644 > > --- > > a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/De > > bugLib.c > > +++ > > b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/De > > b > > +++ ugLib.c > > @@ -150,7 +150,7 @@ DebugPrintMarker ( > > FormatString =3D (CHAR8 *)((UINT64 *)(DebugInfo + 1) + 12)= ; > > > > // > > - // Copy the Format string into the record > > + // Copy the Format string into the record. It will be truncated if = it's too long. > > // > > // According to the content structure of Buffer shown above, the si= ze of > > // the FormatString buffer is the size of Buffer minus the Padding = @@ - > > 158,7 +158,7 @@ DebugPrintMarker ( > > // variable arguments (12 * sizeof (UINT64)). > > // > > DestBufferSize =3D sizeof (Buffer) - 4 - sizeof (EFI_DEBUG_INFO) - = 12 * sizeof > > (UINT64); > > - AsciiStrCpyS (FormatString, DestBufferSize / sizeof (CHAR8), Format= ); > > + AsciiStrnCpyS (FormatString, DestBufferSize / sizeof (CHAR8), Forma= t, > > + DestBufferSize / sizeof (CHAR8) - 1); > > > > // > > // The first 12 * sizeof (UINT64) bytes following EFI_DEBUG_INFO ar= e for > > variable arguments > > -- > > 2.21.0.windows.1 > > > > > >=20