[SS-2017-008] Fix SQL injection in search engine

This commit is contained in:
Daniel Hensby 2017-11-21 16:16:32 +00:00
parent 149d1708b6
commit 4aad42c084
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E

View File

@ -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) {