From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 7183981FD5 for ; Thu, 15 Dec 2016 15:55:01 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 15 Dec 2016 15:55:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,354,1477983600"; d="scan'208";a="798502016" Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by FMSMGA003.fm.intel.com with ESMTP; 15 Dec 2016 15:55:00 -0800 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.227]) by ORSMSX110.amr.corp.intel.com ([169.254.10.17]) with mapi id 14.03.0248.002; Thu, 15 Dec 2016 15:55:00 -0800 From: "Kinney, Michael D" To: "Wu, Hao A" , "edk2-devel@lists.01.org" , "Kinney, Michael D" CC: "Yao, Jiewen" , "Gao, Liming" Thread-Topic: [PATCH 2/6] MdePkg/BaseLib: Add an additional check within (Ascii)StrnCmp Thread-Index: AQHSVf0D/AiSGBGt7ESXtEbZIKnpZKEJsUSA Date: Thu, 15 Dec 2016 23:54:59 +0000 Message-ID: References: <1481714811-12568-1-git-send-email-hao.a.wu@intel.com> <1481714811-12568-3-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1481714811-12568-3-git-send-email-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTFlMDdjN2UtOGY3Zi00MzZiLTgwZmQtZDUxZWIwZDk1MDdmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Inhha2dhcnd3WEVEbXgrejdmSFlVRllcLzluR2NxOXhUTzR6RkN6cWk4TEFnPSJ9 x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Subject: Re: [PATCH 2/6] MdePkg/BaseLib: Add an additional check within (Ascii)StrnCmp X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2016 23:55:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Michael Kinney > -----Original Message----- > From: Wu, Hao A > Sent: Wednesday, December 14, 2016 3:27 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Yao, Jiewen ; G= ao, Liming > ; Kinney, Michael D > Subject: [PATCH 2/6] MdePkg/BaseLib: Add an additional check within (Asci= i)StrnCmp >=20 > This commit adds an addtional check in AsciiStrnCmp and StrnCmp. 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 > Cc: Jiewen Yao > Cc: Liming Gao > Cc: Michael D Kinney > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Hao Wu > --- > MdePkg/Library/BaseLib/String.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/Str= ing.c > index 25962f8..fa96d1c 100644 > --- a/MdePkg/Library/BaseLib/String.c > +++ b/MdePkg/Library/BaseLib/String.c > @@ -1,7 +1,7 @@ > /** @file > Unicode and ASCII string primitives. >=20 > - Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> + Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD License > which accompanies this distribution. The full text of the license may= be found at > @@ -315,6 +315,7 @@ StrnCmp ( > } >=20 > while ((*FirstString !=3D L'\0') && > + (*SecondString !=3D L'\0') && > (*FirstString =3D=3D *SecondString) && > (Length > 1)) { > FirstString++; > @@ -1474,6 +1475,7 @@ AsciiStrnCmp ( > } >=20 > while ((*FirstString !=3D '\0') && > + (*SecondString !=3D '\0') && > (*FirstString =3D=3D *SecondString) && > (Length > 1)) { > FirstString++; > -- > 1.9.5.msysgit.0