From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0704.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe41::704]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 088FE1A1DED for ; Fri, 19 Aug 2016 02:54:09 -0700 (PDT) Received: from CS1PR84MB0037.NAMPRD84.PROD.OUTLOOK.COM (10.162.189.143) by CS1PR84MB0038.NAMPRD84.PROD.OUTLOOK.COM (10.162.189.144) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Fri, 19 Aug 2016 09:54:05 +0000 Received: from CS1PR84MB0037.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.143]) by CS1PR84MB0037.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.143]) with mapi id 15.01.0557.027; Fri, 19 Aug 2016 09:54:06 +0000 From: "Hegde, Nagaraj P" To: Zhang Lubo , "edk2-devel@lists.01.org" CC: Fu Siyuan , Ye Ting , Wu Jiaxin Thread-Topic: [patch] MdeModulePkg:Fix bug in function AsciiStrToIp4. Thread-Index: AQHR+e8mVNzBbHL9MUeyvwKxxv4AwKBQCneg Date: Fri, 19 Aug 2016 09:54:06 +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: authentication-results: spf=none (sender IP is ) smtp.mailfrom=nagaraj-p.hegde@hpe.com; x-originating-ip: [15.219.195.5] x-ms-office365-filtering-correlation-id: 4b09275a-645a-4ecf-cf88-08d3c816c2a0 x-microsoft-exchange-diagnostics: 1; CS1PR84MB0038; 6:Tesid8qkLdF9f+m8Ug5esiRV93w4776wu/ZNd/srYl4XZDD4sgEi/ANHoDcyurdOqsEqamTJi07oIohVwNKTP6XCT/x3MMPKmd9PLhGCeeovHjwQnoAucxvor6OV9QjS8p25YLgxEh1CqMGCq5Aqe6/ThUaxL+4HRI7fGagf04vW16OzjK+UvBisx0CJwyG0XIMEiEn+SkURDnGk7mVzsvYkS7g87KQiYuLgzyrOEwYWzpFvPybfEH3W6LeXMI4vjWUP0EJaCwyzCVUNlqfEZAEtw4phYDS4wMUWNAcMceGn2a6MjnMhuOde5s58e0JnQuPJPy8oUU62dZuW60z4Ig==; 5:tLAyiqLY8TuSYJsf5XVILyXw/TlCwTqvnOsevBTc9lG3dDZSME99c2/p26nIWphmpx9hDSoKbXy43HrjvgTemZ668Zix3WHoVS/5efgY3KVbki6g7P1CYF9EZq8aNewMmkxNjCGwGZMzGynNkjTjEQ==; 24:OAQwVNx+2MV7VVGK5wacnm80joGbef65ixsDEF5OWaRG2TGlxG8DXIPle3K0+/0jcExWl/ontqv2plVfyL9psH5KNE37BV8o6thnsD6f4Lg=; 7:x1AoDB6hfPDJ0S6cJG2a02tdT5hKfpXTiyey85XQlp9qo2gqOqI1RlUYegymn5ZR+P6oJXvyIgBHW/FE8BwNXtX4XDgRNz9DwD48bu/i4+HC+kMGAd2lvwxXu5XpTCpws4VEEWxpfNEiOBQEYi9msh4topKDZCzvd45+Mh+uTVQvmsEwCuCL24PPW2x+B3KmKb6dmUyE2tULBh90zZKtm3uhmYPcht/0Edl2YvvpJFOV3Sp8NSH8uyQxskTdAxQR x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0038; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(150554046322364)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CS1PR84MB0038; BCL:0; PCL:0; RULEID:; SRVR:CS1PR84MB0038; x-forefront-prvs: 0039C6E5C5 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(6009001)(7916002)(377454003)(13464003)(189002)(199003)(77096005)(99286002)(66066001)(19580405001)(33656002)(106116001)(9686002)(122556002)(2950100001)(2900100001)(2501003)(5001770100001)(3846002)(92566002)(102836003)(2906002)(19580395003)(106356001)(101416001)(68736007)(74316002)(189998001)(97736004)(7846002)(6116002)(8936002)(7696003)(7736002)(76176999)(8676002)(10400500002)(54356999)(305945005)(3660700001)(81156014)(81166006)(3280700002)(87936001)(86362001)(50986999)(586003)(105586002)(4326007)(5002640100001)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0038; H:CS1PR84MB0037.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2016 09:54:06.6503 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0038 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: Fri, 19 Aug 2016 09:54:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cosmetic comment: if (!NET_IS_DIGIT(*Ip4Str)) { ^ Add a space here Reviewed-by: Hegde Nagaraj P -----Original Message----- From: Zhang Lubo [mailto:lubo.zhang@intel.com]=20 Sent: Friday, August 19, 2016 1:23 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. 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