From a848882652fbc20acd3527078e08a21475eed7f8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 6 Feb 2014 08:35:55 -0800 Subject: [PATCH] CRM-14091, CRM-14092 - Defensive programming --- CRM/Utils/Check/Security.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Check/Security.php b/CRM/Utils/Check/Security.php index 3c8ed4a079..bb076daa75 100644 --- a/CRM/Utils/Check/Security.php +++ b/CRM/Utils/Check/Security.php @@ -256,10 +256,14 @@ class CRM_Utils_Check_Security { * @return bool */ public function isBrowsable($dir, $url) { + if (empty($dir) || empty($url)) { + return FALSE; + } + $result = FALSE; $file = 'delete-this-' . CRM_Utils_String::createRandom(10, CRM_Utils_String::ALPHANUMERIC); - // this could be a new system with uploads yet -- so we'll make a file + // this could be a new system with no uploads (yet) -- so we'll make a file file_put_contents("$dir/$file", "delete me"); $content = @file_get_contents("$url"); if (stristr($content, $file)) { -- 2.25.1