Permalink
Browse files

Merge pull request #2 from oyejorge/patch-1

Prevent extracting folder if it matches $p_remove_path
  • Loading branch information...
2 parents dc70ad3 + 2c83f50 commit 94198381ee0aefea3ad6ba9c25643440b1faa9e0 @mrook mrook committed Nov 12, 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 9419838

Please sign in to comment.