From bac9941b5ea3fb67f7203726d426afdf84576150 Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 19 May 2011 13:34:43 -0400 Subject: [PATCH] Reject alias names that are too long. Fixes #1510 --- etc/inc/util.inc | 3 +-- usr/local/www/firewall_aliases_edit.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/etc/inc/util.inc b/etc/inc/util.inc index b7df86b979..7b8fc577c9 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -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; diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index ce730e13d1..860274015b 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -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])) {