Skip to content

Commit

Permalink
Fix block padding when the file buffer length is a multiple of 512 an…
Browse files Browse the repository at this point in the history
…d smaller than Archive_Tar buffer length
  • Loading branch information
steffunky committed Sep 14, 2020
1 parent 716aacb commit d73a72a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Archive/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_
while (($v_buffer = fread($v_file, $this->buffer_length)) != '') {
$buffer_length = strlen("$v_buffer");
if ($buffer_length != $this->buffer_length) {
$pack_size = ((int)($buffer_length / 512) + 1) * 512;
$pack_size = ((int)($buffer_length / 512) + ($buffer_length % 512 !== 0 ? 1 : 0)) * 512;
$pack_format = sprintf('a%d', $pack_size);
} else {
$pack_format = sprintf('a%d', $this->buffer_length);
Expand Down

0 comments on commit d73a72a

Please sign in to comment.