Merge pull request #202 from creative-commoners/pulls/2.0/escape-file-execution

FIX Escape file path before loading file from filesystem
This commit is contained in:
Damian Mooyman 2017-12-07 14:59:36 +13:00 committed by GitHub
commit bcf2ac9757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,6 +82,7 @@ class DMSDocument_Controller extends Controller
$finfo = finfo_open(FILEINFO_MIME_TYPE); $finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $path); $mime = finfo_file($finfo, $path);
} elseif (is_executable($fileBin)) { } elseif (is_executable($fileBin)) {
$path = escapeshellarg($path);
// try to use the system tool // try to use the system tool
$mime = `$fileBin -i -b $path`; $mime = `$fileBin -i -b $path`;
$mime = explode(';', $mime); $mime = explode(';', $mime);