Make WordPress Core


Ignore:
Timestamp:
12/13/2009 12:02:01 AM (14 years ago)
Author:
westi
Message:

Fix the IP Address validation code in the FTP class. Fixes #11393 props nacin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-ftp.php

    r8645 r12387  
    279279            if(!$ip) $ip=$host;
    280280            if(!$dns) $dns=$host;
    281             if(ip2long($ip) === -1) {
     281            // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false
     282            // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid
     283            $ipaslong = ip2long($ip);
     284            if ( ($ipaslong == false) || ($ipaslong === -1) ) {
    282285                $this->SendMSG("Wrong host name/address \"".$host."\"");
    283286                return FALSE;
Note: See TracChangeset for help on using the changeset viewer.