From 60baa1c507df9a133c3e49f2f4fde7a5ed702ece Mon Sep 17 00:00:00 2001 From: John Campbell Date: Wed, 22 Feb 2017 12:55:28 -0500 Subject: [PATCH] Allowing symlinks --- index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 0fffdba..ccda804 100644 --- a/index.php +++ b/index.php @@ -36,9 +36,10 @@ if($PASSWORD) { setlocale(LC_ALL,'en_US.UTF-8'); $tmp = realpath($_REQUEST['file']); +$tmp_dir = dirname($_SERVER['SCRIPT_FILENAME']); if($tmp === false) err(404,'File or Directory Not Found'); -if(substr($tmp, 0,strlen(__DIR__)) !== __DIR__) +if(substr($tmp, 0,strlen($tmp_dir)) !== $tmp_dir) err(403,"Forbidden"); if(!$_COOKIE['_sfm_xsrf'])