Make WordPress Core

Changeset 45953 for branches/4.2


Ignore:
Timestamp:
09/04/2019 04:36:50 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Escape the output in wp_ajax_upload_attachment().

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

Location:
branches/4.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2

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

    r31429 r45953  
    3333require_once( ABSPATH . 'wp-admin/admin.php' );
    3434
    35 header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
     35header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
    3636
    3737if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
  • branches/4.2/src/wp-admin/includes/ajax-actions.php

    r44852 r45953  
    18611861                        'data'    => array(
    18621862                                'message'  => __( "You don't have permission to upload files." ),
    1863                                 'filename' => $_FILES['async-upload']['name'],
     1863                                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    18641864                        )
    18651865                ) );
    … …  
    18751875                                'data'    => array(
    18761876                                        'message'  => __( "You don't have permission to attach files to this post." ),
    1877                                         'filename' => $_FILES['async-upload']['name'],
     1877                                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    18781878                                )
    18791879                        ) );
    … …  
    18991899                                'data'    => array(
    19001900                                        'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    1901                                         'filename' => $_FILES['async-upload']['name'],
     1901                                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    19021902                                )
    19031903                        ) );
    … …  
    19141914                        'data'    => array(
    19151915                                'message'  => $attachment_id->get_error_message(),
    1916                                 'filename' => $_FILES['async-upload']['name'],
     1916                                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    19171917                        )
    19181918                ) );
Note: See TracChangeset for help on using the changeset viewer.