Upgrade/Install: Sanitize file name in `File_Upload_Upgrader`.

Merge of [38524] to the 4.2 branch.
Built from https://develop.svn.wordpress.org/branches/4.2@38529


git-svn-id: http://core.svn.wordpress.org/branches/4.2@38470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2016-09-06 17:55:29 +00:00
parent 2c40eb4cf2
commit 0e5485fe33
1 changed files with 5 additions and 1 deletions

View File

@ -2330,8 +2330,12 @@ class File_Upload_Upgrader {
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' ) );
}
}
}