From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F24C1A1E10 for ; Mon, 22 Aug 2016 18:21:52 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP; 22 Aug 2016 18:21:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,563,1464678000"; d="scan'208";a="726637" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 22 Aug 2016 18:21:51 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 22 Aug 2016 18:21:51 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 22 Aug 2016 18:21:51 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.147]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.194]) with mapi id 14.03.0301.000; Tue, 23 Aug 2016 09:21:49 +0800 From: "Fu, Siyuan" To: "Zhang, Lubo" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wu, Jiaxin" , "Hegde Nagaraj P" Thread-Topic: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4. Thread-Index: AQHR+e8jhQf0J1HvhUq2M9zhRxaaZ6BVxYdw Date: Tue, 23 Aug 2016 01:21:49 +0000 Message-ID: References: <1471593183-7776-1-git-send-email-lubo.zhang@intel.com> In-Reply-To: <1471593183-7776-1-git-send-email-lubo.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2E0ZDM4OWYtMDIxZC00ZGU3LWJjM2EtODUyNmMyMzAyNDRiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImtmditkR04rWWQ1VmZZTEpXdVIrWkx1K2VIeXIwSU5RV2ZMR0NzdHhBTVU9In0= x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4. 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, 23 Aug 2016 01:21:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan > -----Original Message----- > From: Zhang, Lubo > Sent: Friday, August 19, 2016 3:53 PM > To: edk2-devel@lists.01.org > Cc: Fu, Siyuan ; Ye, Ting ; Wu, > Jiaxin ; Hegde Nagaraj P > Subject: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4. >=20 > If a FQDN contains 3 dots '.' like "a.b.c.com", the AsciiStrToIp4 > will return success as the HostName has a valid IP address. So we > need to check if it is a decimal character before using > AsciiStrDecimalToUintn. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Zhang Lubo > Cc: Fu Siyuan > Cc: Ye Ting > Cc: Wu Jiaxin > Cc: Hegde Nagaraj P > --- > MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > index ef19439..f4376e9 100644 > --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c > @@ -2724,10 +2724,13 @@ NetLibAsciiStrToIp4 ( >=20 > for (Index =3D 0; Index < 4; Index++) { > TempStr =3D Ip4Str; >=20 > while ((*Ip4Str !=3D '\0') && (*Ip4Str !=3D '.')) { > + if (!NET_IS_DIGIT(*Ip4Str)) { > + return EFI_INVALID_PARAMETER; > + } > Ip4Str++; > } >=20 > // > // The IPv4 address is X.X.X.X > -- > 1.9.5.msysgit.1