forked from Wavyzz/dolibarr
Sec: param onlysimplestring is always 1 or 2
This commit is contained in:
@@ -9175,7 +9175,7 @@ function verifCond($strToEvaluate)
|
||||
* @param string $s String to evaluate
|
||||
* @param int $returnvalue 0=No return (used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
|
||||
* @param int $hideerrors 1=Hide errors
|
||||
* @param string $onlysimplestring '0' (used for computed property of extrafields)=Accept all chars, '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', '2' (rarely used)=Accept also '[]'
|
||||
* @param string $onlysimplestring '0' (deprecated, used for computed property of extrafields)=Accept all chars, '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', '2' (rarely used)=Accept also '[]'
|
||||
* @return mixed Nothing or return result of eval
|
||||
*/
|
||||
function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1')
|
||||
@@ -9192,6 +9192,10 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
||||
global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
|
||||
global $soc; // For backward compatibility
|
||||
|
||||
if (!in_array($onlysimplestring, array('0', '1', '2'))) {
|
||||
return 'Bad call of dol_eval. Parameter onlysimplestring must be 0, 1 or 2';
|
||||
}
|
||||
|
||||
try {
|
||||
// Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing
|
||||
if ($onlysimplestring == '1') {
|
||||
|
||||
Reference in New Issue
Block a user