From: Maximilian Mader Date: Sat, 3 Aug 2013 21:56:13 +0000 (+0200) Subject: Don't allow dates prior to 1980-01-01 X-Git-Tag: 2.0.0_Beta_7~62^2~17^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6079dbbd29a3288156a262a76239567f89c6814c;p=GitHub%2FWoltLab%2FWCF.git Don't allow dates prior to 1980-01-01 See WoltLab/WCF#1443 Zip doesn't support dates prior to `1980-01-01 00:00 UTC` --- diff --git a/wcfsetup/install/files/lib/system/io/ZipWriter.class.php b/wcfsetup/install/files/lib/system/io/ZipWriter.class.php index 39dc4c14d2..08c2e1d9e2 100644 --- a/wcfsetup/install/files/lib/system/io/ZipWriter.class.php +++ b/wcfsetup/install/files/lib/system/io/ZipWriter.class.php @@ -2,6 +2,7 @@ namespace wcf\system\io; use wcf\util\FileUtil; use wcf\util\StringUtil; +use wcf\system\exception\SystemException; /** * Creates a Zip file archive. @@ -81,9 +82,14 @@ class ZipWriter { * * @param string $data content of the file * @param string $name filename - * @param integer $date file creation time as unix timestamp + * @param integer $date file creation time as unix timestamp, must at least be 315532800 (1980-01-01 00:00 UTC) */ - public function addFile($data, $name, $date = 0) { + public function addFile($data, $name, $date = TIME_NOW) { + // 315532800 is the same as strtotime('1980-01-01 00:00 UTC') + if ($date < 315532800) { + throw new SystemException('Unsupported date, must be at least 315532800 (1980-01-01 00:00 UTC)'); + } + // replace backward slashes with forward slashes in the filename $name = StringUtil::replace("\\", "/", $name);