Make WordPress Core

Changeset 45943


Ignore:
Timestamp:
09/04/2019 04:28:49 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Escape the output in wp_ajax_upload_attachment().

Merges [45936] to the 4.9 branch.
Props whyisjake, sstoqnov.

Location:
branches/4.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/async-upload.php

    r41554 r45943  
    2323require_once( ABSPATH . 'wp-admin/admin.php' );
    2424
    25 header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
     25header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
    2626
    2727if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
  • branches/4.9/src/wp-admin/includes/ajax-actions.php

    r44845 r45943  
    20712071            'data'    => array(
    20722072                'message'  => __( 'Sorry, you are not allowed to upload files.' ),
    2073                 'filename' => $_FILES['async-upload']['name'],
     2073                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20742074            )
    20752075        ) );
     
    20852085                'data'    => array(
    20862086                    'message'  => __( 'Sorry, you are not allowed to attach files to this post.' ),
    2087                     'filename' => $_FILES['async-upload']['name'],
     2087                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20882088                )
    20892089            ) );
     
    21092109                'data'    => array(
    21102110                    'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    2111                     'filename' => $_FILES['async-upload']['name'],
     2111                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    21122112                )
    21132113            ) );
     
    21242124            'data'    => array(
    21252125                'message'  => $attachment_id->get_error_message(),
    2126                 'filename' => $_FILES['async-upload']['name'],
     2126                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    21272127            )
    21282128        ) );
Note: See TracChangeset for help on using the changeset viewer.