diff options
author | luk3yx <luk3yx@users.noreply.github.com> | 2023-12-04 21:28:14 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 19:28:14 +1100 |
commit | 03953f0fc0decad503013995cb74bdead4fbe224 (patch) | |
tree | 380381471fa9dfbc70b45a5bbc37ebe9893b9450 | |
parent | cdc3cf55f5b9314236cb3c8454936e84864c2bf6 (diff) | |
download | display_modpack_no_craft-03953f0fc0decad503013995cb74bdead4fbe224.tar.gz display_modpack_no_craft-03953f0fc0decad503013995cb74bdead4fbe224.zip |
Improve exploit fix (#8)
-rw-r--r-- | font_api/fontform.lua | 8 | ||||
-rw-r--r-- | signs_api/init.lua | 5 |
2 files changed, 1 insertions, 12 deletions
diff --git a/font_api/fontform.lua b/font_api/fontform.lua index fb054e0..1388a43 100644 --- a/font_api/fontform.lua +++ b/font_api/fontform.lua @@ -54,13 +54,7 @@ local function show_node_formspec(playername, pos) fs = fs:gsub("context", nodemeta) -- Change all ${} to their corresponding metadata values - fs = fs:gsub("(.)${(.-)}", function(prefix, key) - -- Don't alter escaped keys - if prefix == "\\" then - return prefix .. "${" .. key .. "}" - end - - -- Get the node meta value + fs = fs:gsub("([^\\])${(.-)}", function(prefix, key) return prefix .. minetest.formspec_escape(meta:get_string(key)) end) diff --git a/signs_api/init.lua b/signs_api/init.lua index e5defc3..fd2db03 100644 --- a/signs_api/init.lua +++ b/signs_api/init.lua @@ -28,11 +28,6 @@ local FS = function(...) return minetest.formspec_escape(S(...)) end function signs_api.set_display_text(pos, text, font) local meta = minetest.get_meta(pos) - -- Horrible workaround to prevent the engine from trying to resolve - -- metadata keys - if text:sub(1, 2) == "${" and text:sub(-1) == "}" then - text = text .. " " - end meta:set_string("display_text", text) if text and text ~= "" then meta:set_string("infotext", "\""..text.."\"") |