From f975055464aa0c5ad1052c0dab13f6a84a9ef4b0 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 21 Jan 2022 23:27:03 +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 5474d4b2..04d38c38 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)