mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 15:35:11 +02:00
[ticket/security/235] Only allow one wildcard in the search query to limit the database load
SECURITY-235
This commit is contained in:
parent
8a73eb5f0f
commit
da9910850a
@ -310,6 +310,15 @@ class fulltext_native extends \phpbb\search\base
|
||||
$replace = '$1';
|
||||
$keywords = preg_replace($match, $replace, $keywords);
|
||||
|
||||
// Only allow one wildcard in the search query to limit the database load
|
||||
$match = '#\*#';
|
||||
$replace = '$1';
|
||||
$count_wildcards = substr_count($keywords, '*');
|
||||
|
||||
// Reverse the string to remove all wildcards except the first one
|
||||
$keywords = strrev(preg_replace($match, $replace, strrev($keywords), $count_wildcards - 1));
|
||||
unset($count_wildcards);
|
||||
|
||||
// set the search_query which is shown to the user
|
||||
$this->search_query = $keywords;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user