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 DEC8D81D11 for ; Mon, 31 Oct 2016 00:22:16 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 31 Oct 2016 00:22:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208";a="25941443" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 31 Oct 2016 00:22:10 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) 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:10 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.139]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.104]) with mapi id 14.03.0248.002; Mon, 31 Oct 2016 15:22:07 +0800 From: "Wu, Jiaxin" To: "Fu, Siyuan" , "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: AQHSMx286DeFBs0i7UmPM+fak3Ii3qDCKDuw Date: Mon, 31 Oct 2016 07:22:07 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B7274138A0CF1@SHSMSX103.ccr.corp.intel.com> References: <1477880581-12760-1-git-send-email-siyuan.fu@intel.com> <1477880581-12760-2-git-send-email-siyuan.fu@intel.com> In-Reply-To: <1477880581-12760-2-git-send-email-siyuan.fu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjAwYTMxZDYtNTQ2NS00NjIwLTlhNmMtMmJmMTY2ZWQ1OWYzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Imk1eHFyTDJ0WVFoUmxST0d6blZtMVA2eDJ5NWdHUzg3bnZ2Sm9cL2kyUTdrPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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:22:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Siyuan, =20 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 ; Wu, > Jiaxin > Subject: [Patch 1/2] MdeModulePkg: Check for NULL pointer before > dereference it. >=20 > 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(+) >=20 > 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; > + } > + } >=20 > if (NewStationIp !=3D NULL && !NetIp4IsUnicast (NTOHL (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > -- > 2.7.4.windows.1