summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/socket.cpp6
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
{