Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tar.php

function Archive_Tar::_readLongHeader

Parameters

$v_header:

Return value

bool

2 calls to Archive_Tar::_readLongHeader()
Archive_Tar::_extractInString in vendor/pear/archive_tar/Archive/Tar.php
This method extract from the archive one file identified by $p_filename. The return value is a string with the file content, or null on error.
Archive_Tar::_extractList in vendor/pear/archive_tar/Archive/Tar.php

File

vendor/pear/archive_tar/Archive/Tar.php, line 1822

Class

Archive_Tar
Creates a (compressed) Tar archive

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), "\x00");
    $v_header['filename'] = $v_filename;
    if ($this->_isMaliciousFilename($v_filename)) {
        $this->_error('Malicious .tar detected, file "' . $v_filename . '" will not install in desired directory tree');
        return false;
    }
    return true;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal