Commit b0a63891 authored by xjm's avatar xjm
Browse files

Issue #3026470 by alexpott, jrockowitz, Joseph Zhao: ArchiveTar is throwing fatal error

parent d5876f34
......@@ -157,7 +157,6 @@ class ArchiveTar
* @var string
*/
public $_fmt ='';
/**
* Archive_Tar Class constructor. This flavour of the constructor only
* declare a new Archive_Tar object, identifying it by the name of the
......@@ -265,6 +264,7 @@ public function __construct($p_tarname, $p_compress = null)
}
}
if (version_compare(PHP_VERSION, "5.5.0-dev") < 0) {
$this->_fmt = "a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/" .
"a8checksum/a1typeflag/a100link/a6magic/a2version/" .
......@@ -1411,6 +1411,7 @@ public function _writeHeader($p_filename, $p_stored_filename)
if ($p_stored_filename == '') {
$p_stored_filename = $p_filename;
}
$v_reduced_filename = $this->_pathReduction($p_stored_filename);
if (strlen($v_reduced_filename) > 99) {
......@@ -1423,6 +1424,7 @@ public function _writeHeader($p_filename, $p_stored_filename)
if (@is_link($p_filename)) {
$v_linkname = readlink($p_filename);
}
if (strlen($v_linkname) > 99) {
if (!$this->_writeLongHeader($v_linkname, true)) {
return false;
......@@ -1463,11 +1465,11 @@ public function _writeHeader($p_filename, $p_stored_filename)
$v_devmajor = '';
$v_devminor = '';
$v_prefix = '';
$v_binary_data_first = pack(
"a100a8a8a8a12a12",
$v_reduced_filename,
$v_perms,
$v_uid,
$v_gid,
......@@ -1740,6 +1742,7 @@ public function _readHeader($v_binary_data, &$v_header)
$v_checksum += array_sum(array_map('ord', array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',)));
$v_checksum += array_sum(array_map('ord', array_slice($v_binary_split, 156, 512)));
$v_data = unpack($this->_fmt, $v_binary_data);
if (strlen($v_data["prefix"]) > 0) {
......@@ -1829,7 +1832,6 @@ private function _tarRecToSize($tar_size)
}
}
/**
* Detect and report a malicious file name
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment