Make WordPress Core

Changeset 45955 for branches/4.1


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

Escape the output in wp_ajax_upload_attachment().

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

Location:
branches/4.1
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1

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

    r31430 r45955  
    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.1/src/wp-admin/includes/ajax-actions.php

    r44853 r45955  
    18481848            'data'    => array(
    18491849                'message'  => __( "You don't have permission to upload files." ),
    1850                 'filename' => $_FILES['async-upload']['name'],
     1850                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    18511851            )
    18521852        ) );
     
    18621862                'data'    => array(
    18631863                    'message'  => __( "You don't have permission to attach files to this post." ),
    1864                     'filename' => $_FILES['async-upload']['name'],
     1864                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    18651865                )
    18661866            ) );
     
    18861886                'data'    => array(
    18871887                    'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
    1888                     'filename' => $_FILES['async-upload']['name'],
     1888                    'filename' => esc_html( $_FILES['async-upload']['name'] ),
    18891889                )
    18901890            ) );
     
    19011901            'data'    => array(
    19021902                'message'  => $attachment_id->get_error_message(),
    1903                 'filename' => $_FILES['async-upload']['name'],
     1903                'filename' => esc_html( $_FILES['async-upload']['name'] ),
    19041904            )
    19051905        ) );
Note: See TracChangeset for help on using the changeset viewer.