From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 F129B1A1E11 for ; Mon, 22 Aug 2016 18:37:54 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP; 22 Aug 2016 18:37:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,563,1464678000"; d="scan'208";a="715814" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 22 Aug 2016 18:37:54 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 22 Aug 2016 18:37:54 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 22 Aug 2016 18:37:53 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by shsmsx102.ccr.corp.intel.com ([169.254.2.147]) with mapi id 14.03.0248.002; Tue, 23 Aug 2016 09:37:51 +0800 From: "Ye, Ting" To: "Zhang, Lubo" , "edk2-devel@lists.01.org" CC: "Fu, Siyuan" , "Wu, Jiaxin" , Hegde Nagaraj P Thread-Topic: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4. Thread-Index: AQHR+e8jtpgm/hAF106QjkXMRPH6YqBVyfyA Date: Tue, 23 Aug 2016 01:37:51 +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: 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] 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:37:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting =20 -----Original Message----- From: Zhang, Lubo=20 Sent: Friday, August 19, 2016 3:53 PM To: edk2-devel@lists.01.org Cc: Fu, Siyuan ; Ye, Ting ; Wu, Jia= xin ; Hegde Nagaraj P Subject: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4. If a FQDN contains 3 dots '.' like "a.b.c.com", the AsciiStrToIp4 will retu= rn success as the HostName has a valid IP address. So we need to check if i= t is a decimal character before using AsciiStrDecimalToUintn. 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(+) diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Libr= ary/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