Getting directory sizes with du - use escapeshellarg on the file/directory as unzipping files on the server can result in filenames that need escaping

This commit is contained in:
mjollnir_
2005-11-13 21:19:05 +00:00
parent 953727c4c8
commit 122b18f02f
+1 -1
View File
@@ -4051,7 +4051,7 @@ function get_directory_size($rootdir, $excludefile='') {
// do it this way if we can, it's much faster
if (!empty($CFG->pathtodu) && is_executable(trim($CFG->pathtodu))) {
$command = trim($CFG->pathtodu).' -sk --apparent-size '.$rootdir;
$command = trim($CFG->pathtodu).' -sk --apparent-size '.escapeshellarg($rootdir);
exec($command,$output,$return);
if (is_array($output)) {
return get_real_size(intval($output[0]).'k'); // we told it to return k.