From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B2D4A81FB4 for ; Mon, 13 Feb 2017 18:44:39 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2017 18:44:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,159,1484035200"; d="scan'208";a="58299944" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 13 Feb 2017 18:44:39 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 13 Feb 2017 18:44:38 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 13 Feb 2017 18:44:38 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.59]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Tue, 14 Feb 2017 10:44:36 +0800 From: "Wu, Hao A" To: "edk2-devel@lists.01.org" CC: "Kinney, Michael D" , "Yao, Jiewen" , "Gao, Liming" Thread-Topic: [edk2] [PATCH v2] MdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to handle MaxSize = 0 Thread-Index: AQHShmvowF//tBBgDEK67Xp48QPT8KFny1Gw Date: Tue, 14 Feb 2017 02:44:35 +0000 Message-ID: References: <1487040091-44960-1-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1487040091-44960-1-git-send-email-hao.a.wu@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 v2] MdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to handle MaxSize = 0 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: Tue, 14 Feb 2017 02:44:39 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This patch has the wrong version information. Please ignore this one. Sorry for that. Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ha= o > Wu > Sent: Tuesday, February 14, 2017 10:42 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A; Kinney, Michael D; Yao, Jiewen; Gao, Liming > Subject: [edk2] [PATCH v2] MdePkg/BaseLib: Refine logic for (Ascii)StrnLe= nS to > handle MaxSize =3D 0 >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D378 >=20 > Cc: Jiewen Yao > Cc: Liming Gao > Cc: Michael Kinney > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Hao Wu > --- > MdePkg/Library/BaseLib/SafeString.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/MdePkg/Library/BaseLib/SafeString.c > b/MdePkg/Library/BaseLib/SafeString.c > index 315059e..79c79e0 100644 > --- a/MdePkg/Library/BaseLib/SafeString.c > +++ b/MdePkg/Library/BaseLib/SafeString.c > @@ -128,9 +128,9 @@ StrnLenS ( > ASSERT (((UINTN) String & BIT0) =3D=3D 0); >=20 > // > - // If String is a null pointer, then the StrnLenS function returns zer= o. > + // If String is a null pointer or MaxSize is 0, then the StrnLenS func= tion > returns zero. > // > - if (String =3D=3D NULL) { > + if ((String =3D=3D NULL) || (MaxSize =3D=3D 0)) { > return 0; > } >=20 > @@ -1097,9 +1097,9 @@ AsciiStrnLenS ( > UINTN Length; >=20 > // > - // If String is a null pointer, then the AsciiStrnLenS function return= s zero. > + // If String is a null pointer or MaxSize is 0, then the AsciiStrnLenS= function > returns zero. > // > - if (String =3D=3D NULL) { > + if ((String =3D=3D NULL) || (MaxSize =3D=3D 0)) { > return 0; > } >=20 > -- > 1.9.5.msysgit.0 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel