Fix: sql injection
This commit is contained in:
parent
0e2de4f155
commit
feeb542e80
@ -111,7 +111,7 @@ if ($what == 'mysql')
|
|||||||
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
|
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
|
||||||
if (! $_POST["use_transaction"]) $param.=" -l --single-transaction";
|
if (! $_POST["use_transaction"]) $param.=" -l --single-transaction";
|
||||||
if ($_POST["disable_fk"]) $param.=" -K";
|
if ($_POST["disable_fk"]) $param.=" -K";
|
||||||
if ($_POST["sql_compat"] && $_POST["sql_compat"] != 'NONE') $param.=" --compatible=".GETPOST("sql_compat","alpha");
|
if ($_POST["sql_compat"] && $_POST["sql_compat"] != 'NONE') $param.=" --compatible=".GETPOST("sql_compat","special");
|
||||||
if ($_POST["drop_database"]) $param.=" --add-drop-database";
|
if ($_POST["drop_database"]) $param.=" --add-drop-database";
|
||||||
if ($_POST["sql_structure"])
|
if ($_POST["sql_structure"])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -185,7 +185,12 @@ function GETPOST($paramname,$check='',$method=0)
|
|||||||
if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',trim($out))) $out='';
|
if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',trim($out))) $out='';
|
||||||
// Check if alpha
|
// Check if alpha
|
||||||
//if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out='';
|
//if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out='';
|
||||||
if ($check == 'alpha' && preg_match('/"/',trim($out))) $out=''; // Only " is dangerous because param in url can close the href= or src= and add javascript functions
|
elseif ($check == 'alpha' && preg_match('/"/',trim($out))) $out=''; // Only " is dangerous because param in url can close the href= or src= and add javascript functions
|
||||||
|
elseif ($check == 'special')
|
||||||
|
{
|
||||||
|
$out=trim($out);
|
||||||
|
if (preg_match('/(\s)*|(%20)*/',$out)) $out='';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user