Fix GETPOST
This commit is contained in:
parent
ea266c1f2d
commit
80ed651c5e
@ -672,15 +672,15 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
|
|||||||
if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) $out = '';
|
if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) $out = '';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'nohtml':
|
case 'nohtml': // No html
|
||||||
$out = dol_string_nohtmltag($out, 0);
|
$out = dol_string_nohtmltag($out, 0);
|
||||||
break;
|
break;
|
||||||
case 'alpha': // No html and no ../ and " replaced with ''
|
case 'alpha': // No html and no ../ and "
|
||||||
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
|
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
|
||||||
if (!is_array($out)) {
|
if (!is_array($out)) {
|
||||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||||
// '../' is dangerous because it allows dir transversals
|
// '../' is dangerous because it allows dir transversals
|
||||||
$out = str_replace(array('"', '"'), "''", trim($out));
|
$out = str_replace(array('"', '"'), '', trim($out));
|
||||||
$out = str_replace(array('../'), '', $out);
|
$out = str_replace(array('../'), '', $out);
|
||||||
// keep lines feed
|
// keep lines feed
|
||||||
$out = dol_string_nohtmltag($out, 0);
|
$out = dol_string_nohtmltag($out, 0);
|
||||||
@ -690,7 +690,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
|
|||||||
if (!is_array($out)) {
|
if (!is_array($out)) {
|
||||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||||
// '../' is dangerous because it allows dir transversals
|
// '../' is dangerous because it allows dir transversals
|
||||||
$out = str_replace(array('"', '"'), "", trim($out));
|
$out = str_replace(array('"', '"'), '', trim($out));
|
||||||
$out = str_replace(array('../'), '', $out);
|
$out = str_replace(array('../'), '', $out);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user