mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-07-15 18:56:43 -04:00
Validate & sanitize formspec fields (#3022)
This commit is contained in:
parent
4c6e19968a
commit
833ed77620
4 changed files with 16 additions and 9 deletions
|
@ -345,8 +345,11 @@ local function on_receive_fields(player, fields)
|
|||
data.items = init_items
|
||||
return true
|
||||
|
||||
elseif fields.key_enter_field == "filter" or fields.search then
|
||||
local new = fields.filter:lower()
|
||||
elseif (fields.key_enter_field == "filter" or fields.search)
|
||||
and fields.filter then
|
||||
local new = fields.filter:sub(1, 128) -- truncate to a sane length
|
||||
:gsub("[%z\1-\8\11-\31\127]", "") -- strip naughty control characters (keeps \t and \n)
|
||||
:lower() -- search is case insensitive
|
||||
if data.filter == new then
|
||||
return
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue