[php:localVolDrv]fix #653, #784 problem of _inpath

This commit is contained in:
nao-pon
2014-02-09 15:28:58 +09:00
parent cb7bfc1323
commit aa24cf92d8
+9 -12
View File
@@ -237,7 +237,12 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
protected function _inpath($path, $parent) {
return $path == $parent || strpos($path, $parent.DIRECTORY_SEPARATOR) === 0;
$real_path = realpath($path);
$real_parent = realpath($parent);
if ($real_path && $real_parent) {
return $path === $parent || strpos($real_path, $real_parent.DIRECTORY_SEPARATOR) === 0;
}
return false;
}
@@ -275,7 +280,7 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
// for Inheritance class ( not calling parent::configure() )
$this->aroot = realpath($this->root);
}
if (!$this->_inpath(realpath($path), $this->aroot)) {
if (!$this->_inpath($path, $this->aroot)) {
return $stat;
}
@@ -367,16 +372,8 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
$target = dirname($path).DIRECTORY_SEPARATOR.$target;
}
$atarget = realpath($target);
if (!$atarget) {
return false;
}
$root = $this->root;
$aroot = $this->aroot;
if ($this->_inpath($atarget, $this->aroot)) {
if ($this->_inpath($target, $this->aroot)) {
$atarget = realpath($target);
return $this->_normpath($this->root.DIRECTORY_SEPARATOR.substr($atarget, strlen($this->aroot)+1));
}