Make WordPress Core


Ignore:
Timestamp:
09/19/2017 01:43:28 PM (8 years ago)
Author:
johnbillion
Message:

General: Add missing URL-encoding and add extra hardening to plugin and template names when they're displayed in the admin area.

Merges [41434] with changes to the 3.9 branch.

See #13377

Location:
branches/3.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.9

  • branches/3.9/src/wp-admin/theme-editor.php

    r27369 r41449  
    6969    $file = $allowed_files['style.css'];
    7070} else {
    71     $relative_file = $file;
     71    $relative_file = wp_unslash( $file );
    7272    $file = $theme->get_stylesheet_directory() . '/' . $relative_file;
    7373}
     
    128128<?php endif;
    129129
    130 $description = get_file_description( $file );
     130$file_description = get_file_description( $relative_file );
    131131$file_show = array_search( $file, array_filter( $allowed_files ) );
    132 if ( $description != $file_show )
    133     $description .= ' <span>(' . $file_show . ')</span>';
     132$description = esc_html( $file_description );
     133if ( $file_description != $file_show ) {
     134    $description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
     135}
    134136?>
    135137<div class="wrap">
     
    180182            echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
    181183
    182         $file_description = get_file_description( $absolute_filename );
     184        $file_description = esc_html( get_file_description( $filename ) );
    183185        if ( $file_description != basename( $filename ) )
    184             $file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
     186            $file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>';
    185187
    186188        if ( $absolute_filename == $file )
Note: See TracChangeset for help on using the changeset viewer.