1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-21 05:11:46 +02:00

Changed allowDirs comparsion logic #497

This commit is contained in:
Dmitry Demidovsky
2015-12-05 22:58:00 +03:00
parent 3f02443c1f
commit 3fcb383f49

View File

@@ -153,12 +153,17 @@ class Minify_Source_Factory {
}
if ($this->options['checkAllowDirs']) {
$inAllowedDir = false;
foreach ((array)$this->options['allowDirs'] as $allowDir) {
if (strpos($this->getNormalizedPath($spec['filepath']), $this->getNormalizedPath($allowDir)) !== 0) {
throw new Minify_Source_FactoryException("File '{$spec['filepath']}' is outside \$allowDirs."
. " If the path is resolved via an alias/symlink, look into the \$min_symlinks option.");
if (strpos($this->getNormalizedPath($spec['filepath']), $this->getNormalizedPath($allowDir)) === 0) {
$inAllowedDir = true;
}
}
if (!$inAllowedDir) {
throw new Minify_Source_FactoryException("File '{$spec['filepath']}' is outside \$allowDirs."
. " If the path is resolved via an alias/symlink, look into the \$min_symlinks option.");
}
}
$basename = basename($spec['filepath']);