From 036091a0c670bfde0ea8215e06db305b79f908bf Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 25 Aug 2024 08:56:57 +0200 Subject: [PATCH] Fix bugs in the block list. --- svr.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/svr.js b/svr.js index 79a5673..d2a6148 100644 --- a/svr.js +++ b/svr.js @@ -730,7 +730,7 @@ function ipBlockList(rawBlockList) { var ips = ip.split(":"); var ip2s = []; ips.forEach(function (ipe) { - ip2s.push(parseInt(ipe)); + ip2s.push(parseInt(ipe, 16)); }); return ip2s; } @@ -764,9 +764,9 @@ function ipBlockList(rawBlockList) { function checkIfIPv6CIDRMatches(ipBlock, cidrObject) { if (!cidrObject.v6) return false; for (var i = 0; i < 8; i++) { - if (ipBlock[i] < cidrObject.min[i] || ipBlock[i] > cidrObject.max[i]) return true; + if (ipBlock[i] < cidrObject.min[i] || ipBlock[i] > cidrObject.max[i]) return false; } - return false; + return true; } // Function to add an IP or CIDR block to the block list