summaryrefslogtreecommitdiff
path: root/NetworkPkg/UefiPxeBcDxe
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2016-10-31 10:21:39 +0800
committerFu Siyuan <siyuan.fu@intel.com>2016-10-31 16:04:02 +0800
commitb3400560603bcfaadc08e82a846933446b5afed3 (patch)
treef4663a09ad874ae00608b6f5e756e75c0218f5c6 /NetworkPkg/UefiPxeBcDxe
parente86f363564e79dc719bbeed8ce87271b2972f55d (diff)
downloadedk2-platforms-b3400560603bcfaadc08e82a846933446b5afed3.tar.xz
NetworkPkg: 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 'NetworkPkg/UefiPxeBcDxe')
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 52095c5f76..0552174ac6 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -2013,10 +2013,14 @@ EfiPxeBcSetStationIP (
return EFI_INVALID_PARAMETER;
}
- if (!Mode->UsingIpv6 && NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) {
- return EFI_INVALID_PARAMETER;
+ if (!Mode->UsingIpv6 && 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 (!Mode->Started) {
return EFI_NOT_STARTED;
}