From fe5e3d0fb613655d12e4df487183df34e6174421 Mon Sep 17 00:00:00 2001 From: dd32 Date: Mon, 7 Jun 2010 11:19:51 +0000 Subject: [PATCH] Do not check to see if parents of folders outside of the Destination folder exist within the Archive extractors, unzip_file() will take care of that area. Fixes #13741 git-svn-id: http://svn.automattic.com/wordpress/trunk@15156 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index e5a8c2f5ba..6994a35faa 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -606,6 +606,8 @@ function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) { // Check the parent folders of the folders all exist within the creation array. if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist) continue; + if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it + continue; $parent_folder = dirname($dir); while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) { @@ -685,6 +687,8 @@ function _unzip_file_pclzip($file, $to, $needed_dirs = array()) { // Check the parent folders of the folders all exist within the creation array. if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist) continue; + if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it + continue; $parent_folder = dirname($dir); while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) {