From caa3a139b7702a1e6e076d23126e83d8348aa647 Mon Sep 17 00:00:00 2001 From: Jerome Jutteau Date: Tue, 18 Sep 2018 21:59:31 +0200 Subject: [PATCH] [BUGFIX] Fix crash when admin downloads If the admin tries to download a big file, the file read can cause a crash. Fixes #174 Signed-off-by: Jerome Jutteau --- admin.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/admin.php b/admin.php index 3e8f517..4a3d25f 100644 --- a/admin.php +++ b/admin.php @@ -255,7 +255,12 @@ if (php_sapi_name() == "cli") { header('Content-Disposition: attachment; filename="' . $l['file_name'] . '"'); if (file_exists(VAR_FILES . $p . $l['md5'])) { - readfile(VAR_FILES . $p . $l['md5']); + $r = fopen(VAR_FILES . $p . $l['md5'], 'r'); + while (!feof($r)) { + print fread($r, 1024); + ob_flush(); + } + fclose($r); } exit; } -- 2.34.1