From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 A8B1881C88 for ; Mon, 31 Oct 2016 00:22:47 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 31 Oct 2016 00:22:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208";a="25941539" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 31 Oct 2016 00:22:44 -0700 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, 31 Oct 2016 00:22:44 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 31 Oct 2016 00:22:43 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.139]) by shsmsx102.ccr.corp.intel.com ([169.254.2.206]) with mapi id 14.03.0248.002; Mon, 31 Oct 2016 15:22:41 +0800 From: "Wu, Jiaxin" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Zhang, Lubo" Thread-Topic: [Patch 2/2] NetworkPkg: Check for NULL pointer before dereference it. Thread-Index: AQHSMx295SH0xxLm5E6KqJbv0kiBUqDCKNtA Date: Mon, 31 Oct 2016 07:22:41 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B7274138A0D0F@SHSMSX103.ccr.corp.intel.com> References: <1477880581-12760-1-git-send-email-siyuan.fu@intel.com> <1477880581-12760-3-git-send-email-siyuan.fu@intel.com> In-Reply-To: <1477880581-12760-3-git-send-email-siyuan.fu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTFlYjUwNGQtMTFkOC00Y2MzLTk3N2UtMjA3OGI2ZjlkYWI3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkNnNUhYaG5GbmFWek1CbFwvcEVCcjE3Rkd2RmVQU2lUdE5cLzZtTTJscVwveWM9In0= x-ctpclassification: CTP_IC 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:22:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 ; 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 (NT= OHL > (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 (NewStationI= p- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) { > + return EFI_INVALID_PARAMETER; > + } > } > - > + > if (!Mode->Started) { > return EFI_NOT_STARTED; > } > -- > 2.7.4.windows.1