From 48178d7ab12ad5157500b5b58331175edcd1d400 Mon Sep 17 00:00:00 2001 From: "Fu, Siyuan" Date: Mon, 30 Jun 2014 07:48:23 +0000 Subject: Fix a bug in IP4 driver when computing the network broadcast adress. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu, Siyuan Reviewed-By: Ye, Ting Reviewed-by: Wu, Jiaxin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15603 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'MdeModulePkg/Universal/Network') diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c index 3c29f75..a843150 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); // -- cgit v1.1