From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9CF0A81CC9 for ; Mon, 31 Oct 2016 00:35:47 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP; 31 Oct 2016 00:35:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208";a="25944566" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 31 Oct 2016 00:35:47 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 31 Oct 2016 00:35:47 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 31 Oct 2016 00:35:47 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.139]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.209]) with mapi id 14.03.0248.002; Mon, 31 Oct 2016 15:35:45 +0800 From: "Ye, Ting" To: "Wu, Jiaxin" , "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Zhang, Lubo" Thread-Topic: [Patch 2/2] NetworkPkg: Check for NULL pointer before dereference it. Thread-Index: AQHSMx29mbqqrp5Cf0K8PGhBgk+8OqDBosmAgACJvIA= Date: Mon, 31 Oct 2016 07:35:45 +0000 Message-ID: References: <1477880581-12760-1-git-send-email-siyuan.fu@intel.com> <1477880581-12760-3-git-send-email-siyuan.fu@intel.com> <895558F6EA4E3B41AC93A00D163B7274138A0D0F@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <895558F6EA4E3B41AC93A00D163B7274138A0D0F@SHSMSX103.ccr.corp.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 2/2] NetworkPkg: Check for NULL pointer before dereference it. 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: Mon, 31 Oct 2016 07:35:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting -----Original Message----- From: Wu, Jiaxin=20 Sent: Monday, October 31, 2016 3:23 PM To: Fu, Siyuan ; edk2-devel@lists.01.org Cc: Ye, Ting ; Zhang, Lubo Subject: RE: [Patch 2/2] NetworkPkg: Check for NULL pointer before derefere= nce it. Reviewed-By: Wu Jiaxin Best Regards! Jiaxin > -----Original Message----- > From: Fu, Siyuan > Sent: Monday, October 31, 2016 10:23 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting ; Zhang, Lubo ;=20 > Wu, Jiaxin > Subject: [Patch 2/2] NetworkPkg: Check for NULL pointer before dereferenc= e it. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan > Cc: Ye Ting > Cc: Zhang Lubo > Cc: Wu Jiaxin > --- > NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) >=20 > diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > index 52095c5..0552174 100644 > --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > @@ -2013,10 +2013,14 @@ EfiPxeBcSetStationIP ( > return EFI_INVALID_PARAMETER; > } >=20 > - if (!Mode->UsingIpv6 && NewStationIp !=3D NULL && !NetIp4IsUnicast=20 > (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { > - return EFI_INVALID_PARAMETER; > + if (!Mode->UsingIpv6 && NewStationIp !=3D NULL) { > + if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || > + IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || > + (NewSubnetMask !=3D NULL && !NetIp4IsUnicast (NTOHL=20 > + (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) { > + return EFI_INVALID_PARAMETER; > + } > } > - > + > if (!Mode->Started) { > return EFI_NOT_STARTED; > } > -- > 2.7.4.windows.1