diff --git a/lib/file-control.php b/lib/file-control.php index 212f436..c07eb3c 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -15,22 +15,35 @@ $file = str_replace("|","/",strClean( : $_GET['file'] )); -// Trim any +'s or spaces from the end of file and clear any ../'s -$file = str_replace("../","",rtrim(rtrim($file,'+'),' ')); +// Trim any +'s or spaces from the end of file +$file = rtrim(rtrim($file,'+'),' '); -// Make $file a full path and establish the $fileLoc and $fileName -if (strpos($file,$docRoot)===false && $_GET['action']!="getRemoteFile") {$file=str_replace("|","/",$docRoot.$iceRoot.$file);}; +// Make each path in $file a full path (; seperated list) +$allFiles = explode(";",$file); +for ($i=0; $i"); -}; +// Check through all files to make sure they're valid/safe +$allFiles = explode(";",$file); +for ($i=0; $i"); + }; +} +// Uncomment to alert and console.log the action and file, useful for debugging // echo ";alert('".xssClean($_GET['action'],"html")." : ".$file."');console.log('".xssClean($_GET['action'],"html")." : ".$file."');"; // If we're due to open a file...