From 84ad22efe9549ddbd4dd8123589905f927f17cf7 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Wed, 30 Mar 2016 15:52:49 +0000 Subject: [PATCH] HTTP: Improve detection of valid IP addresses. Merge of [37115] to the 4.0 branch. Built from https://develop.svn.wordpress.org/branches/4.0@37120 git-svn-id: http://core.svn.wordpress.org/branches/4.0@37087 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/http.php b/wp-includes/http.php index b8d3e490c3..6bcf91d710 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -465,7 +465,7 @@ function wp_http_validate_url( $url ) { if ( ! $same_host ) { $host = trim( $parsed_url['host'], '.' ); - if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) { + if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) { $ip = $host; } else { $ip = gethostbyname( $host );