forked from Wavyzz/dolibarr
Sanitize $ and ; for filesystem path (like files).
This commit is contained in:
@@ -1069,7 +1069,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
|
||||
// List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||
// Char '>' '<' '|' '$' and ';' are special chars for shells.
|
||||
// Char '/' and '\' are file delimiters.
|
||||
// -- car can be used into filename to inject special paramaters like --use-compress-program to make command with file as parameter making remote execution of command
|
||||
// Chars '--' can be used into filename to inject special paramaters like --use-compress-program to make command with file as parameter making remote execution of command
|
||||
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';');
|
||||
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
|
||||
$tmp = preg_replace('/\-\-+/', '_', $tmp);
|
||||
@@ -1090,7 +1090,10 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
|
||||
*/
|
||||
function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1)
|
||||
{
|
||||
$filesystem_forbidden_chars = array('<', '>', '?', '*', '|', '"', '°');
|
||||
// List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||
// Char '>' '<' '|' '$' and ';' are special chars for shells.
|
||||
// Chars '--' can be used into filename to inject special paramaters like --use-compress-program to make command with file as parameter making remote execution of command
|
||||
$filesystem_forbidden_chars = array('<', '>', '?', '*', '|', '"', '°', '$', ';');
|
||||
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
|
||||
$tmp = preg_replace('/\-\-+/', '_', $tmp);
|
||||
$tmp = preg_replace('/\s+\-/', ' _', $tmp);
|
||||
|
||||
Reference in New Issue
Block a user