From 12ed33df0c88959972b7e8b34b916fc3b756ee3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 8 Jul 2020 12:55:11 +0200 Subject: [PATCH] Adjust install.php for Tar changes --- wcfsetup/install.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 87e5f21177..012da00bb0 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -930,14 +930,10 @@ class Tar { $this->file->seek($header['offset']); // read data - $content = ''; - $n = floor($header['size'] / 512); - for ($i = 0; $i < $n; $i++) { - $content .= $this->file->read(512); - } - if (($header['size'] % 512) != 0) { - $buffer = $this->file->read(512); - $content .= substr($buffer, 0, $header['size'] % 512); + $content = $this->file->read($header['size']); + + if (strlen($content) != $header['size']) { + throw new SystemException("Could not untar file '".$header['filename']."' to string. Maybe the archive is truncated?"); } return $content; -- 2.20.1