diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-03-21 11:36:04 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-03-23 11:39:15 +0800 |
commit | d0e76ac5ce07eb116f8cbea90b7f373d0c127a78 (patch) | |
tree | 3fc3c828b9822c77ef17f02d9c7406325f13c901 /MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | |
parent | cab6b79cf4958044aa384dc6c1f6ef62ffd8a357 (diff) | |
download | edk2-platforms-d0e76ac5ce07eb116f8cbea90b7f373d0c127a78.tar.xz |
MdeModulePkg/Network: Fix potential ASSERT if NetIp4IsUnicast is called
Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Cc: Subramanian Sriram <sriram-s@hpe.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Diffstat (limited to 'MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c')
-rw-r--r-- | MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c index a2583a490c..5494231166 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c @@ -208,7 +208,7 @@ Mtftp4OverrideValid ( Netmask = NTOHL (Netmask);
Ip = NTOHL (Ip);
- if (!NetIp4IsUnicast (Gateway, Netmask) || !IP4_NET_EQUAL (Gateway, Ip, Netmask)) {
+ if ((Netmask != 0 && !NetIp4IsUnicast (Gateway, Netmask)) || !IP4_NET_EQUAL (Gateway, Ip, Netmask)) {
return FALSE;
}
}
@@ -668,13 +668,13 @@ EfiMtftp4Configure ( ServerIp = NTOHL (ServerIp);
if (!ConfigData->UseDefaultSetting &&
- ((!IP4_IS_VALID_NETMASK (Netmask) || !NetIp4IsUnicast (Ip, Netmask)))) {
+ ((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) {
return EFI_INVALID_PARAMETER;
}
- if ((Gateway != 0) &&
- (!IP4_NET_EQUAL (Gateway, Ip, Netmask) || !NetIp4IsUnicast (Gateway, Netmask))) {
+ if ((Gateway != 0) &&
+ (!IP4_NET_EQUAL (Gateway, Ip, Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Gateway, Netmask)))) {
return EFI_INVALID_PARAMETER;
}
|