From 94960b64d42294ca5dddca2665eb60a8d1230bb9 Mon Sep 17 00:00:00 2001 From: erlehmann Date: Tue, 15 Nov 2022 04:41:01 +0100 Subject: [PATCH] Fix creative mode inventory search crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this patch it was possible for any user to to crash Minetest in creative mode. This was possible because queries in the search field were interpreted as search patterns for string.find(). A search for a single square bracket would reliably crash the server. Also, a search for 6000 times the string “a?” would hang the server. The solution to both bugs is to not interpret the query as a pattern. --- mods/HUD/mcl_inventory/creative.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 704641d89f..517622333f 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -117,7 +117,7 @@ local function filter_item(name, description, lang, filter) else desc = string.lower(minetest.get_translated_string(lang, description)) end - return string.find(name, filter) or string.find(desc, filter) + return string.find(name, filter, nil, true) or string.find(desc, filter, nil, true) end local function set_inv_search(filter, player)