Skip to content

Commit

Permalink
Merge pull request #6 from jecknig/master
Browse files Browse the repository at this point in the history
Correctly escape strings for use in executed code
  • Loading branch information
fieryprophet committed May 20, 2016
2 parents 3535a44 + f5e86ce commit d82fe60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/PHPSandbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -6484,7 +6484,7 @@ protected function prepareVars(){
} else if(is_float($value)){
$output[] = '$' . $name . ' = ' . ($value ? $value : '0.0');
} else if(is_string($value)){
$output[] = '$' . $name . " = '" . addcslashes($value, "'") . "'";
$output[] = '$' . $name . " = '" . addcslashes($value, "'\\") . "'";
} else {
$output[] = '$' . $name . " = null";
}
Expand All @@ -6508,7 +6508,7 @@ protected function prepareConsts(){
} else if(is_float($value)){
$output[] = '\define(' . "'" . $name . "', " . ($value ? $value : '0.0') . ');';
} else if(is_string($value)){
$output[] = '\define(' . "'" . $name . "', '" . addcslashes($value, "'") . "');";
$output[] = '\define(' . "'" . $name . "', '" . addcslashes($value, "'\\") . "');";
} else {
$output[] = '\define(' . "'" . $name . "', null);";
}
Expand Down Expand Up @@ -7123,4 +7123,4 @@ public function __call($method, $arguments){
trigger_error('Fatal error: Call to undefined method PHPSandbox::' . $method, E_ERROR);
return null;
}
}
}

0 comments on commit d82fe60

Please sign in to comment.