From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.7396.1585059999071039108 for ; Tue, 24 Mar 2020 07:26:39 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: dandan.bi@intel.com) IronPort-SDR: hgyMO4HAPhdyRRi+XGCP0Sj0bqQfxMaWrFws7EGSeVTQMdU2ryQhxGJ6Ea2xowcjQNvG2OnbGH ChUtaTmJsCWA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 07:26:38 -0700 IronPort-SDR: PaAADZm/EAR0CGvXcDMAEvG3tTx7lSRp6A75cqYQxTmU9MLzicieCG7q9+hLtVa3+WjfD1IGu7 6BtGK6y9ilDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,300,1580803200"; d="scan'208";a="246689338" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2020 07:26:38 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 24 Mar 2020 07:26:38 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 24 Mar 2020 07:26:37 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.206]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.137]) with mapi id 14.03.0439.000; Tue, 24 Mar 2020 22:26:35 +0800 From: "Dandan Bi" To: "devel@edk2.groups.io" , "jbrasen@nvidia.com" CC: "Dong, Eric" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/HiiDatabase: Do not modify CONST string Thread-Index: AQHV/hLUN59WXPdwzkSnPxgFmVJnTahX08yQ Date: Tue, 24 Mar 2020 14:26:34 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB40D85ED6@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: dandan.bi@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for the update. Reviewed-by: Dandan Bi Thanks, Dandan > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Jeff Brasen > Sent: Friday, March 20, 2020 1:21 AM > To: devel@edk2.groups.io > Cc: Bi, Dandan ; Dong, Eric ; > Jeff Brasen > Subject: [edk2-devel] [PATCH] MdeModulePkg/HiiDatabase: Do not modify > CONST string >=20 > Update function behavior to not modify the incoming string that is marke= d as > CONST in the prototype. >=20 > Signed-off-by: Jeff Brasen > --- > .../Universal/HiiDatabaseDxe/ConfigRouting.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > index 2cad6d29f4..e08a62c387 100644 > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c > @@ -5497,7 +5497,6 @@ HiiBlockToConfig ( > UINTN Index; > UINT8 *TemBuffer; > CHAR16 *TemString; > - CHAR16 TemChar; >=20 > TmpBuffer =3D NULL; >=20 > @@ -5564,10 +5563,14 @@ HiiBlockToConfig ( > // > // Copy and an additional '&' to > // > - TemChar =3D *StringPtr; > - *StringPtr =3D '\0'; > - AppendToMultiString(Config, ConfigRequest); > - *StringPtr =3D TemChar; > + > + TemString =3D AllocateCopyPool (sizeof (CHAR16) * (StringPtr - > + ConfigRequest + 1), ConfigRequest); if (TemString =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + TemString[StringPtr - ConfigRequest] =3D '\0'; > + AppendToMultiString(Config, TemString); FreePool (TemString); >=20 > // > // Parse each if exists > -- > 2.17.1 >=20 >=20 >=20