X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/11be8dc178e77d0b46189bbd8e33a216a9b90942..16b9f61a8ab25bd6c9fbfd0cea00c7bda22f6a71:/wp-admin/includes/class-ftp.php diff --git a/wp-admin/includes/class-ftp.php b/wp-admin/includes/class-ftp.php index 0bf25e9c..80703a95 100644 --- a/wp-admin/includes/class-ftp.php +++ b/wp-admin/includes/class-ftp.php @@ -278,7 +278,10 @@ class ftp_base { $dns=@gethostbyaddr($host); if(!$ip) $ip=$host; if(!$dns) $dns=$host; - if(ip2long($ip) === -1) { + // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false + // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid + $ipaslong = ip2long($ip); + if ( ($ipaslong == false) || ($ipaslong === -1) ) { $this->SendMSG("Wrong host name/address \"".$host."\""); return FALSE; }