Skip to content

Commit

Permalink
Upgrade/Install: Sanitize file name in File_Upload_Upgrader.
Browse files Browse the repository at this point in the history
Merge of [38524] to the 3.7 branch.
Built from https://develop.svn.wordpress.org/branches/3.7@38534


git-svn-id: http://core.svn.wordpress.org/branches/3.7@38475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
swissspidy committed Sep 6, 2016
1 parent afe460a commit b40b064
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wp-admin/includes/class-wp-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1602,8 +1602,12 @@ function __construct($form, $urlholder) {
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
wp_die( $uploads['error'] );

$this->filename = $_GET[$urlholder];
$this->filename = sanitize_file_name( $_GET[ $urlholder ] );
$this->package = $uploads['basedir'] . '/' . $this->filename;

if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) {
wp_die( __( 'Please select a file' ) );
}
}
}

Expand Down

0 comments on commit b40b064

Please sign in to comment.