Skip to content

Commit

Permalink
ensure misuse of clear() wont open a vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkez committed Jan 4, 2020
1 parent df097f2 commit dae95a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ function clear($key) {
// Reset global to default value
$this->hive[$parts[0]]=$this->init[$parts[0]];
else {
// Ensure we have no code injection
$key=preg_replace('/(\)\W*\w+.*$)/','',$key);
eval('unset('.$this->compile('@this->hive.'.$key).');');
if ($parts[0]=='SESSION') {
session_commit();
Expand Down Expand Up @@ -2963,13 +2965,11 @@ function c($val) {
* @param $str string
**/
function token($str) {
$fw=$this->fw;
$str=trim(preg_replace('/\{\{(.+?)\}\}/s',trim('\1'),
$fw->compile($str)));
$str=trim(preg_replace('/\{\{(.+?)\}\}/s','\1',$this->fw->compile($str)));
if (preg_match('/^(.+)(?<!\|)\|((?:\h*\w+(?:\h*[,;]?))+)$/s',
$str,$parts)) {
$str=trim($parts[1]);
foreach ($fw->split(trim($parts[2],"\xC2\xA0")) as $func)
foreach ($this->fw->split(trim($parts[2],"\xC2\xA0")) as $func)
$str=((empty($this->filter[$cmd=$func]) &&
function_exists($cmd)) ||
is_string($cmd=$this->filter($func)))?
Expand Down

0 comments on commit dae95a0

Please sign in to comment.