From 5fbe929a1d5b4c8354406245db743c597f052a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 7 Aug 2018 00:18:25 +0200 Subject: [PATCH] [ticket/15692] Check if argument is a valid resource PHPBB3-15692 --- phpBB/language/en/common.php | 1 + phpBB/phpbb/storage/storage.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index c7325043b2..1bd8ac1e44 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -745,6 +745,7 @@ $lang = array_merge($lang, array( 'STORAGE_CANNOT_CREATE_DIR' => 'Can not create directory.', 'STORAGE_CANNOT_OPEN_FILE' => 'Can not open file.', 'STORAGE_CANNOT_CREATE_FILE' => 'Can not create file.', + 'STORAGE_INVALID_RESOURCE' => 'Resource is invalid.', 'TB' => 'TB', 'TERMS_LINK' => 'Terms', diff --git a/phpBB/phpbb/storage/storage.php b/phpBB/phpbb/storage/storage.php index 545f342e82..25c81075c4 100644 --- a/phpBB/phpbb/storage/storage.php +++ b/phpBB/phpbb/storage/storage.php @@ -271,6 +271,11 @@ class storage throw new exception('STORAGE_FILE_EXISTS', $path); } + if (!is_resource($resource)) + { + throw new exception('STORAGE_INVALID_RESOURCE'); + } + $adapter = $this->get_adapter(); if ($adapter instanceof stream_interface)