From 935b0f4e0fd0f9ddc1f8d045f690b0864a47e82b Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 6 Aug 2006 16:38:54 +0000 Subject: 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 --- src/socket.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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 { -- cgit v1.2.3