Make WordPress Core

Changeset 45941 for branches/5.0


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

Escape the output in wp_ajax_upload_attachment().

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

Location:
branches/5.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

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

    r41554 r45941  
    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/5.0/src/wp-admin/includes/ajax-actions.php

    r44844 r45941  
    20692069                        'data'    => array(
    20702070                                'message'  => __( 'Sorry, you are not allowed to upload files.' ),
    2071                                 'filename' => $_FILES['async-upload']['name'],
     2071                                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20722072                        )
    20732073                ) );
     
    20832083                                'data'    => array(
    20842084                                        'message'  => __( 'Sorry, you are not allowed to attach files to this post.' ),
    2085                                         'filename' => $_FILES['async-upload']['name'],
     2085                                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20862086                                )
    20872087                        ) );
     
    21072107                                'data'    => array(
    21082108                                        'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    2109                                         'filename' => $_FILES['async-upload']['name'],
     2109                                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    21102110                                )
    21112111                        ) );
     
    21222122                        'data'    => array(
    21232123                                'message'  => $attachment_id->get_error_message(),
    2124                                 'filename' => $_FILES['async-upload']['name'],
     2124                                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    21252125                        )
    21262126                ) );
Note: See TracChangeset for help on using the changeset viewer.