summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorFu, Siyuan <siyuan.fu@intel.com>2014-06-30 07:48:23 +0000
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2014-06-30 07:48:23 +0000
commit48178d7ab12ad5157500b5b58331175edcd1d400 (patch)
tree73eb6084bf21cd2af85b218014771a84b448be2c /MdeModulePkg
parent9e2364ef1203f81c8572766d360fb7b10c2cda56 (diff)
downloadedk2-platforms-48178d7ab12ad5157500b5b58331175edcd1d400.tar.xz
Fix a bug in IP4 driver when computing the network broadcast adress.
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> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15603 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
index 3c29f75f88..a843150f46 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
@@ -581,9 +581,10 @@ Ip4SetAddress (
Interface->SubnetBrdcast = (IpAddr | ~SubnetMask);
Type = NetGetIpClass (IpAddr);
+ ASSERT (Type <= IP4_ADDR_CLASSC);
Len = NetGetMaskLength (SubnetMask);
- ASSERT (Len >= 1);
- Netmask = gIp4AllMasks[MIN ((Len - 1), Type << 3)];
+ ASSERT (Len < IP4_MASK_NUM);
+ Netmask = gIp4AllMasks[MIN (Len, Type << 3)];
Interface->NetBrdcast = (IpAddr | ~Netmask);
//