Merge pull request #753 from nemunaire/b/cidr-comparaison

Ensure comparaison of same CIDR IP version
This commit is contained in:
Mike Cao 2021-08-13 19:29:25 -07:00 committed by GitHub
commit f1cb7e13c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@ export default async (req, res) => {
const addr = ipaddr.parse(ip); const addr = ipaddr.parse(ip);
const range = ipaddr.parseCIDR(i); const range = ipaddr.parseCIDR(i);
if (addr.match(range)) return true; if (addr.kind() === range[0].kind() && addr.match(range)) return true;
} }
return false; return false;