diff options
author | Ermal <eri@pfsense.org> | 2013-02-04 13:35:32 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-02-04 13:36:25 +0000 |
commit | b5b5bcc041484d070fdcd1c2fecef777d85b78e7 (patch) | |
tree | 360600f1f115bbfcc045805c4f769c801968ce5f | |
parent | a75a49f6e5c31568af6c25bb95d833a0be69fa00 (diff) | |
download | pfsense-b5b5bcc041484d070fdcd1c2fecef777d85b78e7.zip pfsense-b5b5bcc041484d070fdcd1c2fecef777d85b78e7.tar.gz |
Make more strict checks during is_ip* functions. Helps http://forum.pfsense.org/index.php/topic,58399.0.html and http://forum.pfsense.org/index.php/topic,58273.0.html
-rw-r--r-- | etc/inc/util.inc | 4 | ||||
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 988ddff..edbc4ff 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -474,13 +474,15 @@ function is_ipaddr($ipaddr) { /* returns true if $ipaddr is a valid IPv6 address */ function is_ipaddrv6($ipaddr) { + if (!is_string($ipaddr) || empty($ipaddr)) + return false; $result = Net_IPv6::checkIPv6($ipaddr); return $result; } /* returns true if $ipaddr is a valid dotted IPv4 address */ function is_ipaddrv4($ipaddr) { - if (!is_string($ipaddr)) + if (!is_string($ipaddr) || empty($ipaddr)) return false; $ip_long = ip2long($ipaddr); diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index f040520..7fcfb97 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -124,7 +124,7 @@ if ($_POST) { $input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within the chosen interface's subnet '%2\$s'."), $_POST['gateway'],$subnet); } } - if(is_ipaddrv6($_POST['gateway'])) { + else if(is_ipaddrv6($_POST['gateway'])) { /* do not do a subnet match on a link local address, it's valid */ if(! preg_match("/fe80::/", $_POST['gateway'])) { $parent_ip = get_interface_ipv6($_POST['interface']); |