From b14f6d58b472e20b3e6cffd54916ea4fea526acd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 20 May 2018 11:08:33 +0300 Subject: implement hard limits on downloaded data size for general fetching and cache plugins: MAX_DOWNLOAD_FILE_SIZE & MAX_CACHE_FILE_SIZE --- plugins/af_zz_imgproxy/init.php | 2 +- plugins/cache_starred_images/init.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 plugins/af_zz_imgproxy/init.php mode change 100644 => 100755 plugins/cache_starred_images/init.php (limited to 'plugins') diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php old mode 100644 new mode 100755 index 935cbdbcf..1c1e99ae4 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -61,7 +61,7 @@ class Af_Zz_ImgProxy extends Plugin { send_local_file($local_filename); } else { - $data = fetch_file_contents(array("url" => $url)); + $data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); if ($data) { diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php old mode 100644 new mode 100755 index 6c32ff57f..8a3464e0d --- a/plugins/cache_starred_images/init.php +++ b/plugins/cache_starred_images/init.php @@ -194,7 +194,7 @@ class Cache_Starred_Images extends Plugin implements IHandler { //_debug("cache_images: downloading: $src to $local_filename"); if (!file_exists($local_filename)) { - $file_content = fetch_file_contents($src); + $file_content = fetch_file_contents(["url" => $src, "max_size" => MAX_CACHE_FILE_SIZE]); if ($file_content && strlen($file_content) > MIN_CACHE_FILE_SIZE) { file_put_contents($local_filename, $file_content); -- cgit v1.2.3