Permalink
Browse files

Prevent extracting folder if it matches $p_remove_path

  • Loading branch information...
1 parent dc70ad3 commit 2c83f50519ea42de74349db9358f6a99a4d4c972 @oyejorge oyejorge committed Nov 11, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 Archive/Tar.php
View
@@ -1599,10 +1599,14 @@ function _extractList($p_path, &$p_list_detail, $p_mode,
if (($v_extract_file) && (!$v_listing))
{
if (($p_remove_path != '')
- && (substr($v_header['filename'], 0, $p_remove_path_size)
- == $p_remove_path))
+ && (substr($v_header['filename'].'/', 0, $p_remove_path_size)
+ == $p_remove_path)) {
$v_header['filename'] = substr($v_header['filename'],
$p_remove_path_size);
+ if( $v_header['filename'] == '' ){
+ continue;
+ }
+ }
if (($p_path != './') && ($p_path != '/')) {
while (substr($p_path, -1) == '/')
$p_path = substr($p_path, 0, strlen($p_path)-1);

0 comments on commit 2c83f50

Please sign in to comment.