From d51a940d0fcc84a40a8d600e6bd6cedef16a9266 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 11 Oct 2021 01:37:53 -0600 Subject: [PATCH] If the cidr is empty then return false. --- resources/functions.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/functions.php b/resources/functions.php index d164131c0f..a8e45e92a8 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -81,9 +81,14 @@ } if (!function_exists('check_cidr')) { - function check_cidr ($cidr,$ip_address) { - list ($subnet, $mask) = explode ('/', $cidr); - return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet); + function check_cidr($cidr, $ip_address) { + if (isset($cidr) && strlen($cidr) > 0) { + list ($subnet, $mask) = explode ('/', $cidr); + return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet); + } + else { + return false; + } } }