diff options
author | Chris Buechler <cmb@pfsense.org> | 2009-12-12 23:46:25 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2009-12-12 23:46:25 -0500 |
commit | b29b1a339cf13010c64a58daa2ec5ee31b0391bd (patch) | |
tree | a50219e4061bcf89144d50314e5de7026383581e /usr/local | |
parent | 7b995bec3f7c389228688206aae0b30d63b09340 (diff) | |
download | pfsense-b29b1a339cf13010c64a58daa2ec5ee31b0391bd.zip pfsense-b29b1a339cf13010c64a58daa2ec5ee31b0391bd.tar.gz |
fix input validation of gateways. Ticket #173
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 415823f..c588ca5 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -94,8 +94,10 @@ if ($_POST) { $input_errors[] = "A valid gateway IP address must be specified."; } if ($_POST['gateway'] && (is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) { - if(! ip_in_subnet($_POST['gateway'], get_interface_subnet($interface))) { - $input_errors[] = "The Address {$_POST['gateway']} does not lie within the chosen interface's subnet"; + $parent_ip = get_interface_ip($_POST['interface']); + $parent_sn = get_interface_subnet($_POST['interface']); + if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn)) { + $input_errors[] = "The Address {$_POST['gateway']} does not lie within the chosen interface's subnet."; } } if ((($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']))) { |