From c33443c34066cd9e73ec8a594869c79f3ea7b6ba Mon Sep 17 00:00:00 2001 From: Evertton de Lima Date: Sun, 9 Jun 2013 09:41:20 -0300 Subject: [PATCH] Prevent go out of the workspace... fix issue #425. --- components/project/class.project.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/project/class.project.php b/components/project/class.project.php index f4bac8b..3cc8afc 100755 --- a/components/project/class.project.php +++ b/components/project/class.project.php @@ -110,7 +110,7 @@ class Project extends Common { if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' || !$this->isAbsPath($this->path)) { $this->path = $this->SanitizePath(); } - if($this->path != '') { + if($this->path != '' && $this->path != '..') { $pass = $this->checkDuplicate(); if($pass){ if(!$this->isAbsPath($this->path)) { @@ -233,6 +233,8 @@ class Project extends Common { // prevent go out of the workspace while (strpos($path , '../') !== false) $path = str_replace( '../', '', $path ); + while(strpos($path, '/..') !== false) + $path = str_replace('/..', '', $path); return $path; }