diff options
author | Fu Siyuan <siyuan.fu@intel.com> | 2016-10-31 10:21:39 +0800 |
---|---|---|
committer | Fu Siyuan <siyuan.fu@intel.com> | 2016-10-31 16:04:02 +0800 |
commit | b3400560603bcfaadc08e82a846933446b5afed3 (patch) | |
tree | f4663a09ad874ae00608b6f5e756e75c0218f5c6 /NetworkPkg | |
parent | e86f363564e79dc719bbeed8ce87271b2972f55d (diff) | |
download | edk2-b3400560603bcfaadc08e82a846933446b5afed3.tar.gz edk2-b3400560603bcfaadc08e82a846933446b5afed3.tar.bz2 edk2-b3400560603bcfaadc08e82a846933446b5afed3.zip |
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')
-rw-r--r-- | NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 |
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;
}
|