Reject alias names that are too long. Fixes #1510

This commit is contained in:
jim-p 2011-05-19 13:34:43 -04:00
parent dfa6dedad7
commit bac9941b5e
2 changed files with 2 additions and 3 deletions

View File

@ -473,8 +473,7 @@ function is_validaliasname($name) {
$reserved = array("port", "pass");
if (in_array($name, $reserved, true))
return; /* return NULL */
if (!preg_match("/[^a-zA-Z0-9_]/", $name))
if (!preg_match("/[^a-zA-Z0-9_]/", $name) && (strlen($name) < 32))
return true;
else
return false;

View File

@ -142,7 +142,7 @@ if ($_POST) {
$input_errors[] = gettext("Reserved word used for alias name.");
} else {
if (is_validaliasname($_POST['name']) == false)
$input_errors[] = gettext("The alias name may only consist of the characters") . " a-z, A-Z, 0-9, _.";
$input_errors[] = gettext("The alias name must be less than 32 characters long and may only consist of the characters") . " a-z, A-Z, 0-9, _.";
}
/* check for name conflicts */
if (empty($a_aliases[$id])) {