From ed3fd851f1c63523958aafe3d3ecbfc51619e7b6 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Mon, 14 Jan 2019 11:57:16 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B01933:=20Security=20hardening?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/backup.class.inc.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/setup/backup.class.inc.php b/setup/backup.class.inc.php index cb18168140..75d2ef439d 100644 --- a/setup/backup.class.inc.php +++ b/setup/backup.class.inc.php @@ -528,14 +528,21 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the " */ public function DownloadBackup($sFile) { - header('Content-Description: File Transfer'); - header('Content-Type: multipart/x-zip'); - header('Content-Disposition: inline; filename="'.basename($sFile).'"'); - header('Expires: 0'); - header('Cache-Control: must-revalidate'); - header('Pragma: public'); - header('Content-Length: '.filesize($sFile)); - readfile($sFile); + if (file_exists($sFile)) + { + header('Content-Description: File Transfer'); + header('Content-Type: multipart/x-zip'); + header('Content-Disposition: inline; filename="'.basename($sFile).'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: '.filesize($sFile)); + readfile($sFile) ; + } + else + { + throw new InvalidParameterException('Invalid file path'); + } } /**