From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F29E481CCB for ; Mon, 31 Oct 2016 00:29:19 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP; 31 Oct 2016 00:29:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208,217";a="25620345" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga005.jf.intel.com with ESMTP; 31 Oct 2016 00:29:13 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 31 Oct 2016 00:29:13 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.2]) with mapi id 14.03.0248.002; Mon, 31 Oct 2016 15:29:11 +0800 From: "Fu, Siyuan" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Zhang, Lubo" Thread-Topic: [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it. Thread-Index: AQHSM0d9/5mPZwxjHEaZuK+pDw33m6DCKj6Q Date: Mon, 31 Oct 2016 07:29:10 +0000 Message-ID: References: <1477880581-12760-1-git-send-email-siyuan.fu@intel.com> <1477880581-12760-2-git-send-email-siyuan.fu@intel.com> <895558F6EA4E3B41AC93A00D163B7274138A0CF1@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <895558F6EA4E3B41AC93A00D163B7274138A0CF1@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjAwYTMxZDYtNTQ2NS00NjIwLTlhNmMtMmJmMTY2ZWQ1OWYzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Imk1eHFyTDJ0WVFoUmxST0d6blZtMVA2eDJ5NWdHUzg3bnZ2Sm9cL2kyUTdrPSJ9 x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [Patch 1/2] MdeModulePkg: 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:29:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Jiaxin, you are correct. I will delete these line when commit the p= atch. BestRegards Fu Siyuan From: Wu, Jiaxin Sent: Monday, October 31, 2016 3:22 PM To: Fu, Siyuan ; edk2-devel@lists.01.org Cc: Ye, Ting ; Zhang, Lubo Subject: RE: [Patch 1/2] MdeModulePkg: Check for NULL pointer before derefe= rence it. Siyuan, I think the below piece code should be dropped in EfiPxeBcSetStationIP() fu= nction: if (NewStationIp !=3D NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr= [0]), NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; } Others is good to me. 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 <= lubo.zhang@intel.com>; Wu, > Jiaxin > > Subject: [Patch 1/2] MdeModulePkg: Check for NULL pointer before > dereference it. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan = > > Cc: Ye Ting > > Cc: Zhang Lubo > > Cc: Wu Jiaxin > > --- > MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > index 4746256..43568ed 100644 > --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > @@ -2317,6 +2317,14 @@ EfiPxeBcSetStationIP ( > if (NewSubnetMask !=3D NULL && !IP4_IS_VALID_NETMASK (NTOHL > (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > } > + > + if (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 (NewStationIp !=3D NULL && !NetIp4IsUnicast (NTOHL (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > -- > 2.7.4.windows.1