public function Archive_Tar::_readLongHeader

public Archive_Tar::_readLongHeader(&$v_header)

Parameters

$v_header:

Return value

bool

File

modules/system/system.tar.inc, line 1821

Class

Archive_Tar

Code

public function _readLongHeader(&$v_header) 
 {
  $v_filename = '';
  $v_filesize = $v_header['size'];
  $n = floor($v_header['size'] / 512);
  for ($i = 0; $i < $n; $i++) {
    $v_content = $this->_readBlock();
    $v_filename .= $v_content;
  }
  if (($v_header['size'] % 512) != 0) {
    $v_content = $this->_readBlock();
    $v_filename .= $v_content;
  }

  // ----- Read the next header
  $v_binary_data = $this->_readBlock();

  if (!$this->_readHeader($v_binary_data, $v_header)) {
    return false;
  }

  $v_filename = rtrim(substr($v_filename, 0, $v_filesize), "\0");
  $v_header['filename'] = $v_filename;
  if ($this->_maliciousFilename($v_filename)) {
    $this->_error(
    'Malicious .tar detected, file "' . $v_filename .
      '" will not install in desired directory tree'
      );
    return false;
  }

  return true;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.tar.inc/function/Archive_Tar::_readLongHeader/7.x