From 1e5d6fff42e9699c3c005a7c654c9cd62af13197 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Mon, 3 Jun 2024 09:41:55 -0400 Subject: [PATCH] formspec_escape stability improvement * formspec_escape causes server crash, when text argument is a number. the `tostring(text)` prevents this * backported https://github.com/MultiCraft/MultiCraft/pull/87 --- builtin/common/misc_helpers.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index b7bd4d6a7..be19e5b51 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -254,6 +254,7 @@ end function core.formspec_escape(text) + text = tostring(text) if text ~= nil then text = text:gsub("\\", "\\\\") text = text:gsub("%]", "\\]")