From a1adf5af8394960a1bc2813364b800180df27f84 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Sun, 8 Nov 2015 13:12:54 +0100 Subject: Ensure hostname is not an IP address. --- includes/utils.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'includes/utils.php') diff --git a/includes/utils.php b/includes/utils.php index 79888dd..993300b 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -153,6 +153,11 @@ function match_ipv6($ip, $ip_only = true) { * otherwise. */ function match_hostname($hostname) { + // That's an IP address so it is not a valid hostname. + if (match_ipv4($hostame) || match_ipv6($hostname)) { + return false; + } + return ( // Valid characters check preg_match('/^(_?[a-z\d](-*[_a-z\d])*)(\.(_?[a-z\d](-*[_a-z\d])*))*$/i', $hostname) -- cgit v1.2.3