Fix weird bug that caused IP::isInRange("80.0.0.0", "94.0.0.0/24") to return true...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 31 May 2009 14:52:16 +0000 (14:52 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 31 May 2009 14:52:16 +0000 (14:52 +0000)
includes/IP.php

index a208542..355c7b6 100644 (file)
@@ -502,9 +502,10 @@ class IP {
      */
     public static function isInRange( $addr, $range ) {
     // Convert to IPv6 if needed
-        $unsignedIP = self::toHex( $addr );
+        $unsignedIP = self::toUnsigned( $addr );
         list( $start, $end ) = self::parseRange( $range );
-        return (($unsignedIP >= $start) && ($unsignedIP <= $end));
+        return (($unsignedIP >= base_convert($start, 16, 10)) &&
+               ($unsignedIP <= base_convert($end, 16, 10)));
     }
 
     /**