Skip to content

Commit a60ef5a

Browse files
author
Rory Winston
committed
Add /0 netmask check
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0@761985 13f79535-47bb-0310-9956-ffa450edef68
1 parent b8bc7f8 commit a60ef5a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/java/org/apache/commons/net/SubnetUtilsTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,14 @@ public void testAddresses() {
5858
assertFalse(info.isInRange("192.168.1.1"));
5959
assertFalse(info.isInRange("192.168.0.255"));
6060
}
61+
62+
public void testZeroNetmaskBits() {
63+
try {
64+
SubnetUtils utils = new SubnetUtils("192.168.0.1/0");
65+
assertTrue("/0 should be an invalid mask", false);
66+
}
67+
catch (Exception e) {
68+
;
69+
}
70+
}
6171
}

0 commit comments

Comments
 (0)