mirror of
https://github.com/jimeh/litemysql.git
synced 2026-02-19 04:46:39 +00:00
fixed an issue with conditions building which didn't properly escapse special characters, leaving yourself open to remote SQL injection if passing direct user-input into a condition
This commit is contained in:
@@ -633,7 +633,7 @@ class LiteMySQL {
|
||||
} elseif ( preg_match('/^[0-9]+$/', $value) ) {
|
||||
$cond[] = "`id` = '".$value."'";
|
||||
} else {
|
||||
$cond[] = $value;
|
||||
$cond[] = $this->sql_quote($value);
|
||||
}
|
||||
}
|
||||
$operator = ( !empty($options['operator']) ) ? $options['operator'] : 'AND' ;
|
||||
@@ -694,6 +694,8 @@ class LiteMySQL {
|
||||
}
|
||||
if ( ($column == 'integer' || $column == 'float') && preg_match('/^[0-9\-\.]+$/', $string) ) {
|
||||
return $string;
|
||||
} elseif ( preg_match('/^[0-9\-\.]+$/', $string) ) {
|
||||
return $string;
|
||||
} else {
|
||||
return "'".addslashes($string)."'";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user