diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-06 16:38:54 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-06 16:38:54 +0000 |
commit | 935b0f4e0fd0f9ddc1f8d045f690b0864a47e82b (patch) | |
tree | 8793fe573691631d36573cee3667b60a10153982 | |
parent | 622050cd0a96f3e101c345cd547ee00a5d431aeb (diff) |
Clamp mask sizes to 128 for ipv6 and 32 for ipv4
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4734 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/socket.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index 276ccb270..993b7e90b 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -96,6 +96,9 @@ bool MatchCIDR(const char* address, const char* cidr_mask) { memcpy(&addr_raw, &address_in6.s6_addr, 16); memcpy(&mask_raw, &mask_in6.s6_addr, 16); + + if (mask > 128) + mask = 128; } else { @@ -111,6 +114,9 @@ bool MatchCIDR(const char* address, const char* cidr_mask) { memcpy(&addr_raw, &address_in4.s_addr, 4); memcpy(&mask_raw, &mask_in4.s_addr, 4); + + if (mask > 32) + mask = 32; } else { |