mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
[SS-2017-008] Fix SQL injection in search engine
This commit is contained in:
parent
149d1708b6
commit
4aad42c084
@ -228,6 +228,8 @@ class SQLite3Database extends SS_Database {
|
||||
public function searchEngine($classesToSearch, $keywords, $start, $pageLength, $sortBy = "Relevance DESC",
|
||||
$extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false
|
||||
) {
|
||||
$start = (int)$start;
|
||||
$pageLength = (int)$pageLength;
|
||||
$keywords = $this->escapeString(str_replace(array('*','+','-','"','\''), '', $keywords));
|
||||
$htmlEntityKeywords = htmlentities(utf8_decode($keywords));
|
||||
|
||||
@ -249,7 +251,7 @@ class SQLite3Database extends SS_Database {
|
||||
$extraFilters['File'] .= " AND ShowInSearch <> 0";
|
||||
}
|
||||
|
||||
$limit = $start . ", " . (int) $pageLength;
|
||||
$limit = $start . ", " . $pageLength;
|
||||
|
||||
$notMatch = $invertedMatch ? "NOT " : "";
|
||||
if($keywords) {
|
||||
|
Loading…
Reference in New Issue
Block a user