From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 5A5A42097FA8F for ; Thu, 2 Aug 2018 22:09:29 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2018 22:09:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,437,1526367600"; d="scan'208";a="59363994" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 02 Aug 2018 22:08:37 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 2 Aug 2018 22:08:37 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 2 Aug 2018 22:08:37 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.81]) by shsmsx102.ccr.corp.intel.com ([169.254.2.124]) with mapi id 14.03.0319.002; Fri, 3 Aug 2018 13:08:35 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] MdePkg/BaseLib: Add an additional check within AsciiStriCmp Thread-Index: AQHUKtu7efNqMLmsHECtNxH84BsnPKStei/Q Date: Fri, 3 Aug 2018 05:08:34 +0000 Message-ID: References: <20180803034055.123124-1-ruiyu.ni@intel.com> In-Reply-To: <20180803034055.123124-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdePkg/BaseLib: Add an additional check within AsciiStriCmp X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2018 05:09:29 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ru= iyu > Ni > Sent: Friday, August 03, 2018 11:41 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A > Subject: [edk2] [PATCH] MdePkg/BaseLib: Add an additional check within > AsciiStriCmp >=20 > This commit adds an addtional check in AsciiStriCmp. It > explicitly checks the end of the sting pointed by 'SecondString' to make > the code logic easier for reading and to prevent possible mis-reports by > static code checkers. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Hao A Wu > --- > MdePkg/Library/BaseLib/String.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/MdePkg/Library/BaseLib/String.c > b/MdePkg/Library/BaseLib/String.c > index e7fe513aec..cb90774c86 100644 > --- a/MdePkg/Library/BaseLib/String.c > +++ b/MdePkg/Library/BaseLib/String.c > @@ -1262,7 +1262,7 @@ AsciiStriCmp ( >=20 > UpperFirstString =3D InternalBaseLibAsciiToUpper (*FirstString); > UpperSecondString =3D InternalBaseLibAsciiToUpper (*SecondString); > - while ((*FirstString !=3D '\0') && (UpperFirstString =3D=3D UpperSecon= dString)) { > + while ((*FirstString !=3D '\0') && (*SecondString !=3D '\0') && (Upper= FirstString > =3D=3D UpperSecondString)) { > FirstString++; > SecondString++; > UpperFirstString =3D InternalBaseLibAsciiToUpper (*FirstString); > -- > 2.16.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel