mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Resolves #138 Add propper input validation to aliases. Do not allow to nested different types of aliases. Do not allow on ports to enter something that is not in the range 0-65535.
This commit is contained in:
parent
21d41faad3
commit
f71e0ac64d
@ -250,14 +250,23 @@ if ($_POST) {
|
||||
}
|
||||
$final_address_details .= "||";
|
||||
$isfirst++;
|
||||
}
|
||||
if (is_alias($_POST["address{$x}"])) {
|
||||
if (!alias_same_type($_POST["address{$x}"], $_POST['type']))
|
||||
$wrongaliases .= " " . $_POST["address{$x}"];
|
||||
|
||||
if (is_alias($_POST["address{$x}"])) {
|
||||
if (!alias_same_type($_POST["address{$x}"], $_POST['type']))
|
||||
$wrongaliases .= " " . $_POST["address{$x}"];
|
||||
} else if ($_POST['type'] == "port") {
|
||||
if (preg_match("/[^[[:digit:]]]/", $_POST["address{$x}"]) || strlen($_POST["address{$x}"]) > 5)
|
||||
$input_errors[] = $_POST["address{$x}"] . " is not a valid {$_POST['type']} alias.";
|
||||
else if (intval($_POST["address{$x}"]) < 0 || intval($_POST["address{$x}"]) > 65535)
|
||||
$input_errors[] = $_POST["address{$x}"] . " is not a valid port alias.";
|
||||
} else if ($_POST['type'] == "host" || $_POST['type'] == "network") {
|
||||
if (!is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]))
|
||||
$input_errors[] = $_POST["address{$x}"] . " is not a valid {$_POST['type']} alias.";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($wrongaliases <> "")
|
||||
$input_errors[] = "The following aliases: {$wrongaliases} \ncannot be nested cause they are not of the same type.";
|
||||
$input_errors[] = "The alias(es): {$wrongaliases} \ncannot be nested cause they are not of the same type.";
|
||||
}
|
||||
|
||||
if (!$input_errors) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user