Skip to content
Snippets Groups Projects
Commit a8488826 authored by totten's avatar totten
Browse files

CRM-14091, CRM-14092 - Defensive programming

parent 384f991e
No related branches found
No related tags found
No related merge requests found
......@@ -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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment