Skip to content

Commit

Permalink
[php:localVolDrv]fix Studio-42#653, Studio-42#784 problem of _inpath
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Feb 9, 2014
1 parent cb7bfc1 commit aa24cf9
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions php/elFinderVolumeLocalFileSystem.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ protected function _path($path) {
* @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;
}


Expand Down Expand Up @@ -275,7 +280,7 @@ protected function _stat($path) {
// 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;
}

Expand Down Expand Up @@ -367,16 +372,8 @@ protected function readlink($path) {
$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));
}

Expand Down

0 comments on commit aa24cf9

Please sign in to comment.