diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php index 9190223b9..e0d449a5b 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php @@ -242,7 +242,13 @@ class Util public static function isDomain($domain) { $pattern = '/^(?:(?:[a-z\pL0-9]|[a-z\pL0-9][a-z\pL0-9\-]*[a-z\pL0-9])\.)*(?:[a-z\pL0-9]|[a-z\pL0-9][a-z\pL0-9\-]*[a-z\pL0-9])$/iu'; - if (preg_match($pattern, $domain)) { + $parts = explode(".", $domain); + if (ctype_digit($parts[0]) && ctype_digit($parts[count($parts)-1])) { + // according to rfc1123 2.1 + // a valid host name can never have the dotted-decimal form #.#.#.#, since at least the highest-level + // component label will be alphabetic. + return false; + } elseif (preg_match($pattern, $domain)) { return true; } return false;