Skip to content

Commit 54720a1

Browse files
committed
Upgrade/Install: Sanitize file name in File_Upload_Upgrader.
Built from https://develop.svn.wordpress.org/trunk@38524 git-svn-id: http://core.svn.wordpress.org/trunk@38465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 4131900 commit 54720a1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: wp-admin/includes/class-file-upload-upgrader.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ public function __construct( $form, $urlholder ) {
100100
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
101101
wp_die( $uploads['error'] );
102102

103-
$this->filename = $_GET[$urlholder];
103+
$this->filename = sanitize_file_name( $_GET[ $urlholder ] );
104104
$this->package = $uploads['basedir'] . '/' . $this->filename;
105+
106+
if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) {
107+
wp_die( __( 'Please select a file' ) );
108+
}
105109
}
106110
}
107111

Diff for: wp-includes/version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @global string $wp_version
66
*/
7-
$wp_version = '4.7-alpha-38523';
7+
$wp_version = '4.7-alpha-38524';
88

99
/**
1010
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)