WordPress.org

Make WordPress Core

Changeset 45947


Ignore:
Timestamp:
09/04/2019 04:34:50 PM (17 months ago)
Author:
SergeyBiryukov
Message:

Escape the output in wp_ajax_upload_attachment().

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

Location:
branches/4.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

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

    r37914 r45947  
    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.7/src/wp-admin/includes/ajax-actions.php

    r44847 r45947  
    20092009            'data'    => array(
    20102010                'message'  => __( 'Sorry, you are not allowed to upload files.' ),
    2011                 'filename' => $_FILES['async-upload']['name'],
     2011                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20122012            )
    20132013        ) );
     
    20232023                'data'    => array(
    20242024                    'message'  => __( 'Sorry, you are not allowed to attach files to this post.' ),
    2025                     'filename' => $_FILES['async-upload']['name'],
     2025                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20262026                )
    20272027            ) );
     
    20472047                'data'    => array(
    20482048                    'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    2049                     'filename' => $_FILES['async-upload']['name'],
     2049                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20502050                )
    20512051            ) );
     
    20622062            'data'    => array(
    20632063                'message'  => $attachment_id->get_error_message(),
    2064                 'filename' => $_FILES['async-upload']['name'],
     2064                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    20652065            )
    20662066        ) );
Note: See TracChangeset for help on using the changeset viewer.