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

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


git-svn-id: http://core.svn.wordpress.org/branches/4.5@38467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2016-09-06 17:34:33 +00:00
parent c1e4d25350
commit b7bb8822d7
2 changed files with 6 additions and 2 deletions

View File

@ -2659,8 +2659,12 @@ class File_Upload_Upgrader {
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
wp_die( $uploads['error'] ); wp_die( $uploads['error'] );
$this->filename = $_GET[$urlholder]; $this->filename = sanitize_file_name( $_GET[ $urlholder ] );
$this->package = $uploads['basedir'] . '/' . $this->filename; $this->package = $uploads['basedir'] . '/' . $this->filename;
if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) {
wp_die( __( 'Please select a file' ) );
}
} }
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5.4-alpha-38000'; $wp_version = '4.5.4-alpha-38526';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.