diff --git a/libraries/joomla/archive/tar.php b/libraries/joomla/archive/tar.php index cb0bfe0513cb8..4479c61587c7d 100644 --- a/libraries/joomla/archive/tar.php +++ b/libraries/joomla/archive/tar.php @@ -33,7 +33,7 @@ class JArchiveTar implements JArchiveExtractable * @since 11.1 */ private $_types = array( - 0x0 => 'Unix file', + 0x0 => 'Unix file', 0x30 => 'File', 0x31 => 'Link', 0x32 => 'Symbolic link', @@ -183,6 +183,17 @@ protected function _getTarInfo(& $data) ); } + /** + * This variable has been set in the previous loop, + * meaning that the filename was present in the previous block + * to allow more than 100 characters - see below + */ + if (isset($longlinkfilename)) + { + $info['filename'] = $longlinkfilename; + unset($longlinkfilename); + } + if (!$info) { if (class_exists('JError')) @@ -211,7 +222,7 @@ protected function _getTarInfo(& $data) if (($info['typeflag'] == 0) || ($info['typeflag'] == 0x30) || ($info['typeflag'] == 0x35)) { - /* File or folder. */ + // File or folder. $file['data'] = $contents; $mode = hexdec(substr($info['mode'], 4, 3)); @@ -219,9 +230,18 @@ protected function _getTarInfo(& $data) (($mode & 0x100) ? 'x' : '-') . (($mode & 0x040) ? 'r' : '-') . (($mode & 0x020) ? 'w' : '-') . (($mode & 0x010) ? 'x' : '-') . (($mode & 0x004) ? 'r' : '-') . (($mode & 0x002) ? 'w' : '-') . (($mode & 0x001) ? 'x' : '-'); } + elseif (chr($info['typeflag']) == 'L' && $info['filename'] == '././@LongLink') + { + // GNU tar ././@LongLink support - the filename is actually in the contents, + // setting a variable here so we can test in the next loop + $longlinkfilename = $contents; + + // And the file contents are in the next block so we'll need to skip this + continue; + } else { - /* Some other type. */ + // Some other type. } $return_array[] = $file;