Make WordPress Core

Changeset 45938


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

Escape the output in wp_ajax_upload_attachment().

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

Location:
branches/5.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

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

    r44331 r45938  
    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.2/src/wp-admin/includes/ajax-actions.php

    r45828 r45938  
    23132313                                'data'    => array(
    23142314                                        'message'  => __( 'Sorry, you are not allowed to upload files.' ),
    2315                                         'filename' => $_FILES['async-upload']['name'],
     2315                                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23162316                                ),
    23172317                        )
    … …  
    23292329                                        'data'    => array(
    23302330                                                'message'  => __( 'Sorry, you are not allowed to attach files to this post.' ),
    2331                                                 'filename' => $_FILES['async-upload']['name'],
     2331                                                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23322332                                        ),
    23332333                                )
    … …  
    23552355                                        'data'    => array(
    23562356                                                'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    2357                                                 'filename' => $_FILES['async-upload']['name'],
     2357                                                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23582358                                        ),
    23592359                                )
    … …  
    23722372                                'data'    => array(
    23732373                                        'message'  => $attachment_id->get_error_message(),
    2374                                         'filename' => $_FILES['async-upload']['name'],
     2374                                        'filename' => esc_html( $_FILES['async-upload']['name'] ),
    23752375                                ),
    23762376                        )
Note: See TracChangeset for help on using the changeset viewer.