Skip to content
Snippets Groups Projects
Commit 6b2887e3 authored by Auke Kok's avatar Auke Kok Committed by sofar
Browse files

Limit sign length to 512 (~6 lines of 80 char or so).

Players can enter unlimited text into the field, causing lag and
potentially locking up clients. I have not found any negative effects
server side, other than the large storage needed to store the long
text.
parent 14cc07bf
No related branches found
No related tags found
No related merge requests found
...@@ -2575,12 +2575,19 @@ local function register_sign(material, desc, def) ...@@ -2575,12 +2575,19 @@ local function register_sign(material, desc, def)
minetest.record_protection_violation(pos, player_name) minetest.record_protection_violation(pos, player_name)
return return
end end
local meta = minetest.get_meta(pos) local text = fields.text
if not fields.text then return end if not text then
return
end
if string.len(text) > 512 then
minetest.chat_send_player(player_name, "Text too long")
return
end
minetest.log("action", (player_name or "") .. " wrote \"" .. minetest.log("action", (player_name or "") .. " wrote \"" ..
fields.text .. "\" to sign at " .. minetest.pos_to_string(pos)) text .. "\" to sign at " .. minetest.pos_to_string(pos))
meta:set_string("text", fields.text) local meta = minetest.get_meta(pos)
meta:set_string("infotext", '"' .. fields.text .. '"') meta:set_string("text", text)
meta:set_string("infotext", '"' .. text .. '"')
end, end,
}) })
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment