Make WordPress Core

Changeset 37115


Ignore:
Timestamp:
03/30/2016 03:37:26 PM (9 years ago)
Author:
ocean90
Message:

HTTP: Improve detection of valid IP addresses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/http.php

    r36870 r37115  
    524524    $parsed_home = @parse_url( get_option( 'home' ) );
    525525
    526     if ( isset( $parsed_home['host'] ) ) { 
     526    if ( isset( $parsed_home['host'] ) ) {
    527527        $same_host = ( strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ) || 'localhost' === strtolower( $parsed_url['host'] ) );
    528528    } else {
     
    532532    if ( ! $same_host ) {
    533533        $host = trim( $parsed_url['host'], '.' );
    534         if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
     534        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 ) ) {
    535535            $ip = $host;
    536536        } else {
Note: See TracChangeset for help on using the changeset viewer.