summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorxjm2019-01-17 17:20:45 (GMT)
committerxjm2019-01-17 17:21:07 (GMT)
commit5525e51d1a38b5483918627c2acdd2999c98a6f3 (patch)
treeb86ecd6e1947dd0e5317234265c1c5716a28840f /core
parentc32de04af995da8b2a697292a156de6e7d13ef3b (diff)
Issue #3026470 by alexpott, jrockowitz, Joseph Zhao: ArchiveTar is throwing fatal error
(cherry picked from commit b0a63891a7919c5982a8fbe19f74e7a34acd9774)
Diffstat (limited to 'core')
-rw-r--r--core/lib/Drupal/Core/Archiver/ArchiveTar.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/lib/Drupal/Core/Archiver/ArchiveTar.php b/core/lib/Drupal/Core/Archiver/ArchiveTar.php
index abee870..12722e6 100644
--- a/core/lib/Drupal/Core/Archiver/ArchiveTar.php
+++ b/core/lib/Drupal/Core/Archiver/ArchiveTar.php
@@ -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 @@ class ArchiveTar
}
}
+
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 @@ class ArchiveTar
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 @@ class ArchiveTar
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 @@ class ArchiveTar
$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 @@ class ArchiveTar
$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 @@ class ArchiveTar
}
}
-
/**
* Detect and report a malicious file name
*