mirror of
https://github.com/jimeh/litemysql.git
synced 2026-02-19 12:56:43 +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) ) {
|
} elseif ( preg_match('/^[0-9]+$/', $value) ) {
|
||||||
$cond[] = "`id` = '".$value."'";
|
$cond[] = "`id` = '".$value."'";
|
||||||
} else {
|
} else {
|
||||||
$cond[] = $value;
|
$cond[] = $this->sql_quote($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$operator = ( !empty($options['operator']) ) ? $options['operator'] : 'AND' ;
|
$operator = ( !empty($options['operator']) ) ? $options['operator'] : 'AND' ;
|
||||||
@@ -694,6 +694,8 @@ class LiteMySQL {
|
|||||||
}
|
}
|
||||||
if ( ($column == 'integer' || $column == 'float') && preg_match('/^[0-9\-\.]+$/', $string) ) {
|
if ( ($column == 'integer' || $column == 'float') && preg_match('/^[0-9\-\.]+$/', $string) ) {
|
||||||
return $string;
|
return $string;
|
||||||
|
} elseif ( preg_match('/^[0-9\-\.]+$/', $string) ) {
|
||||||
|
return $string;
|
||||||
} else {
|
} else {
|
||||||
return "'".addslashes($string)."'";
|
return "'".addslashes($string)."'";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user