[VD:FTP] fix #1514 security vulnerability in the archive command

This commit is contained in:
nao-pon
2016-07-11 14:23:00 +09:00
parent ce14aff140
commit 87c7a79813
+4 -6
View File
@@ -1095,15 +1095,13 @@ class elFinderVolumeFTP extends elFinderVolumeDriver {
$file_names_string = "";
foreach (scandir($tmpDir) as $filename) {
if ('.' == $filename) {
if ('.' === $filename || '..' === $filename) {
continue;
}
if ('..' == $filename) {
continue;
}
$file_names_string = $file_names_string . '"' . $filename . '" ';
$filename = escapeshellarg('.'.DIRECTORY_SEPARATOR.$filename);
$file_names_string .= $filename . ' ';
}
$command = escapeshellcmd($arc['cmd'] . ' ' . $arc['argc'] . ' "' . $name . '" ' . $file_names_string);
$command = escapeshellcmd($arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . $file_names_string);
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from