Making WordPress.org

Changeset 14449


Ignore:
Timestamp:
05/09/2025 10:07:55 AM (9 months ago)
Author:
paulkevan
Message:

Login: make sure values are cast as strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions.php

    r14335 r14449  
    466466
    467467    $from = 'wordpress.org';
     468    // Make sure value is a string since it is compared next.
    468469    if ( $redirect_to ) {
    469         $from = $redirect_to;
     470        $from = sanitize_text_field( $redirect_to );
    470471    } elseif ( !empty( $_REQUEST['from'] ) ) {
    471         $from = $_REQUEST['from'];
     472        $from = sanitize_text_field( $_REQUEST['from'] );
    472473    } elseif ( !empty( $_REQUEST['redirect_to'] ) ) {
    473         $from = $_REQUEST['redirect_to'];
     474        $from = sanitize_text_field( $_REQUEST['redirect_to'] );
    474475    }
    475476
     
    569570    }
    570571
    571     $came_from = $_REQUEST['redirect_to'] ?? ( $_SERVER['HTTP_REFERER'] ?? '' );
     572    // Make sure value is a string, since setcookie requires it to be.
     573    $came_from = sanitize_text_field( $_REQUEST['redirect_to'] ?? ( $_SERVER['HTTP_REFERER'] ?? '' ) );
    572574    if ( ! $came_from ) {
    573575        return;
Note: See TracChangeset for help on using the changeset viewer.