diff options
author | stilez <stilez@users.noreply.github.com> | 2016-01-14 12:25:23 +0000 |
---|---|---|
committer | stilez <stilez@users.noreply.github.com> | 2016-01-14 12:25:23 +0000 |
commit | 66672b1ba2d66fee0c2af1d502eed456015e34e9 (patch) | |
tree | 9d0ee119ab3287ec991bc6cd26be3a17c80fc30b /src/etc | |
parent | cafe90385da383eb3db7d6f581d2a512065e425b (diff) | |
download | pfsense-66672b1ba2d66fee0c2af1d502eed456015e34e9.zip pfsense-66672b1ba2d66fee0c2af1d502eed456015e34e9.tar.gz |
variable
Used explode to array rather than to a list, and tested array size, so as not to assume it has exactly 2 parts separated by "/".
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/util.inc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 252e48f..2cc71f2 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -818,10 +818,10 @@ function is_subnetoralias($subnet) { function subnet_size($subnet, $exact=false) { $parts = explode("/", $subnet); if (count($parts) == 2) { - if (is_ipaddrv4($ip)) { - return subnet_size_by_netmask(4, $bits, $exact); - } elseif (is_ipaddrv6($ip)) { - return subnet_size_by_netmask(6, $bits, $exact); + if (is_ipaddrv4($parts[0])) { + return subnet_size_by_netmask(4, $parts[1], $exact); + } elseif (is_ipaddrv6($parts[0])) { + return subnet_size_by_netmask(6, $parts[1], $exact); } } return 0; |