From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 A7264208AE35F for ; Fri, 22 Feb 2019 07:48:09 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Feb 2019 07:48:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,400,1544515200"; d="scan'208";a="277085474" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 22 Feb 2019 07:48:08 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 22 Feb 2019 07:48:07 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.102]) by shsmsx102.ccr.corp.intel.com ([169.254.2.207]) with mapi id 14.03.0415.000; Fri, 22 Feb 2019 23:48:06 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools: Add parameter check for the AsciiStringToUint64 Thread-Index: AQHUypYcoFP0QVqkskSZOgzqWhyTXKXr9pag Date: Fri, 22 Feb 2019 15:48:06 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3E6287@SHSMSX104.ccr.corp.intel.com> References: <20190222100502.10332-1-bob.c.feng@intel.com> In-Reply-To: <20190222100502.10332-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWM4OTdkYWItMmNkOS00NTc4LThkZGMtZTgwYjRiODFiYWJiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiazlkOHBcL29sRE42RkwwckhcL1NCejR0VnNOdlBiQXNwNGJHbmNTc0Z3cUdYVmc5NytoZm8zRTcyM3JvNkl6RTVEIn0= dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Add parameter check for the AsciiStringToUint64 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 15:48:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Bob: This function is used to convert string to UINT64. So, the string len sho= uld not be too long. I think UINT8 max value 255 is enough for its usage. Thanks Liming > -----Original Message----- > From: Feng, Bob C > Sent: Friday, February 22, 2019 6:05 PM > To: edk2-devel@lists.01.org > Cc: Feng, Bob C ; Gao, Liming > Subject: [Patch] BaseTools: Add parameter check for the AsciiStringToUint= 64 >=20 > If the input parameter AsciiString length is greater > than 255, the GenFv will hang. >=20 > This patch is to fix this issue. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Bob Feng > Cc: Liming Gao > --- > BaseTools/Source/C/Common/ParseInf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Co= mmon/ParseInf.c > index 3907f44331..b29f4c2f93 100644 > --- a/BaseTools/Source/C/Common/ParseInf.c > +++ b/BaseTools/Source/C/Common/ParseInf.c > @@ -493,11 +493,11 @@ Returns: > EFI_SUCCESS Number successfully converted. > EFI_ABORTED Invalid character encountered. >=20 > --*/ > { > - UINT8 Index; > + UINT32 Index; > UINT64 Value; > CHAR8 CurrentChar; >=20 > // > // Initialize the result > @@ -506,11 +506,11 @@ Returns: > Index =3D 0; >=20 > // > // Check input parameter > // > - if (AsciiString =3D=3D NULL || ReturnValue =3D=3D NULL) { > + if (AsciiString =3D=3D NULL || ReturnValue =3D=3D NULL || strlen(Ascii= String) > 0xFFFFFFFF) { > return EFI_INVALID_PARAMETER; > } > while (AsciiString[Index] =3D=3D ' ') { > Index ++; > } > -- > 2.20.1.windows.1