summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2016-10-31 10:21:24 +0800
committerFu Siyuan <siyuan.fu@intel.com>2016-10-31 16:03:00 +0800
commite86f363564e79dc719bbeed8ce87271b2972f55d (patch)
tree9577796f03f8cfdb9ddabca354274df034a80587 /MdeModulePkg
parent92ec8772df33f3c758763adcaf42fd42c8da812c (diff)
downloadedk2-platforms-e86f363564e79dc719bbeed8ce87271b2972f55d.tar.xz
MdeModulePkg: Check for NULL pointer before dereference it.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 4746256fa0..639da4880f 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -2317,11 +2317,15 @@ EfiPxeBcSetStationIP (
if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) {
return EFI_INVALID_PARAMETER;
}
-
- if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), 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;
+ }
+ }
+
Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);
Mode = Private->PxeBc.Mode;