Skip to content
Snippets Groups Projects
Commit 77466c4f authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #31941: fix customized directory traversal protection for shared hosting...

rel #31941: fix customized directory traversal protection for shared hosting Bokeh with dedicated virtual host
parent b62da9fa
Branches
Tags 7.3.20
3 merge requests!1192Master,!1191Hotline master,!1190Hotline#31941 pb sur integration d une image dans un article
- ticket #31941 : Correction compatibilité explorateur de fichier / hébergement mutualisé sans sous-répertoire
\ No newline at end of file
......@@ -24,18 +24,14 @@ header('Content-type: application/json');
* @param string $path
*/
function opacTraversalProtect ($path) {
$path = (string)$path;
$parts = explode('/', $path);
array_shift($parts);
if (2 > count($parts)) {
exit();
}
if ('userfiles' != $parts[1]) {
exit();
}
if (in_array('..', $parts)) {
exit();
}
$path = (string)$path;
$parts = explode('/', $path);
array_shift($parts);
if (in_array('..', $parts)
|| 2 > count($parts)
|| !in_array('userfiles', $parts))
exit();
}
......@@ -64,7 +60,7 @@ if(!isset($_GET)) {
} else {
if(isset($_GET['mode']) && $_GET['mode']!='') {
switch($_GET['mode']) {
default:
opacTraversalProtect($_GET['path']);
$fm->error($fm->lang('MODE_ERROR'));
......@@ -78,7 +74,7 @@ if(!isset($_GET)) {
break;
case 'getfolder':
opacTraversalProtect($_GET['path']);
opacTraversalProtect($_GET['path']);
if($fm->getvar('path')) {
$response = $fm->getfolder();
}
......@@ -121,12 +117,12 @@ if(!isset($_GET)) {
} else if(isset($_POST['mode']) && $_POST['mode']!='') {
switch($_POST['mode']) {
default:
$fm->error($fm->lang('MODE_ERROR'));
break;
case 'add':
if($fm->postvar('currentpath')) {
opacTraversalProtect($_POST['currentpath']);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment