Skip to content

Commit

Permalink
fix a silly error in security checks. Mostly helps Windows to work pr…
Browse files Browse the repository at this point in the history
…operly
  • Loading branch information
[email protected] committed Dec 8, 2011
1 parent 1cc3490 commit 6dd45a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions timthumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ protected function getLocalImagePath($src){
if(file_exists ($this->docRoot . '/' . $src)) {
$this->debug(3, "Found file as " . $this->docRoot . '/' . $src);
$real = realpath($this->docRoot . '/' . $src);
if(stripos($real, $this->docRoot) === 0){
if(stripos($real, $this->docRoot) == 0){
return $real;
} else {
$this->debug(1, "Security block: The file specified occurs outside the document root.");
Expand All @@ -855,7 +855,7 @@ protected function getLocalImagePath($src){
if($absolute && file_exists($absolute)){ //realpath does file_exists check, so can probably skip the exists check here
$this->debug(3, "Found absolute path: $absolute");
if(! $this->docRoot){ $this->sanityFail("docRoot not set when checking absolute path."); }
if(stripos($absolute, $this->docRoot) === 0){
if(stripos($absolute, $this->docRoot) == 0){
return $absolute;
} else {
$this->debug(1, "Security block: The file specified occurs outside the document root.");
Expand All @@ -878,7 +878,7 @@ protected function getLocalImagePath($src){
if(file_exists($base . $src)){
$this->debug(3, "Found file as: " . $base . $src);
$real = realpath($base . $src);
if(stripos($real, $this->docRoot) === 0){
if(stripos($real, $this->docRoot) == 0){
return $real;
} else {
$this->debug(1, "Security block: The file specified occurs outside the document root.");
Expand Down

0 comments on commit 6dd45a2

Please sign in to comment.