mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix arg types for htmlentities() and uniqid() by casting to string
This commit is contained in:
parent
1aa9f97897
commit
f63dcc1b6f
|
|
@ -243,7 +243,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1)
|
|||
$ip = (empty($_SERVER['REMOTE_ADDR']) ? 'unknown' : $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if ($stopcode) {
|
||||
$errormessage = 'Access refused to '.htmlentities($ip, ENT_COMPAT, 'UTF-8').' by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type='.htmlentities($type, ENT_COMPAT, 'UTF-8');
|
||||
$errormessage = 'Access refused to '.htmlentities($ip, ENT_COMPAT, 'UTF-8').' by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type='.htmlentities((string) $type, ENT_COMPAT, 'UTF-8');
|
||||
//$errormessage .= ' paramkey='.htmlentities($key, ENT_COMPAT, 'UTF-8'); // Disabled to avoid text injection
|
||||
|
||||
$errormessage2 = 'page='.htmlentities((empty($_SERVER["REQUEST_URI"]) ? '' : $_SERVER["REQUEST_URI"]), ENT_COMPAT, 'UTF-8');
|
||||
|
|
@ -573,7 +573,7 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) {
|
|||
// Note: Using MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL is not recommended: if a user succeed in entering a data from
|
||||
// a public page with a link that make a token regeneration, it can make use of the backoffice no more possible !
|
||||
// Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
|
||||
$token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
|
||||
$token = dol_hash(uniqid((string) mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
|
||||
$_SESSION['newtoken'] = $token;
|
||||
dol_syslog("NEW TOKEN generated by : ".$_SERVER['PHP_SELF'], LOG_DEBUG);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user