Siyuan, I think the below piece code should be dropped in EfiPxeBcSetStationIP() function:
if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; } Others is good to me. Reviewed-By: Wu Jiaxin <jiaxin...@intel.com> 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 <ting...@intel.com>; Zhang, Lubo <lubo.zh...@intel.com>; Wu, > Jiaxin <jiaxin...@intel.com> > Subject: [Patch 1/2] MdeModulePkg: Check for NULL pointer before > dereference it. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan <siyuan...@intel.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Zhang Lubo <lubo.zh...@intel.com> > Cc: Wu Jiaxin <jiaxin...@intel.com> > --- > 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 != NULL && !IP4_IS_VALID_NETMASK (NTOHL > (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > } > + > + if (NewStationIp != NULL) { > + if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || > + IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || > + (NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) { > + return EFI_INVALID_PARAMETER; > + } > + } > > if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > -- > 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel