mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-01-03 22:20:20 +01:00
Limit chatcommand parameter length in command blocks (#695)
This commit is contained in:
parent
8051129f82
commit
320ec93544
@ -1,4 +1,5 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
local param_maxlen = mesecon.setting("commandblock_param_maxlen", 10000)
|
||||||
|
|
||||||
minetest.register_chatcommand("say", {
|
minetest.register_chatcommand("say", {
|
||||||
params = "<text>",
|
params = "<text>",
|
||||||
@ -156,6 +157,11 @@ local function commandblock_action_on(pos, node)
|
|||||||
minetest.chat_send_player(owner, "The command "..cmd.." does not exist")
|
minetest.chat_send_player(owner, "The command "..cmd.." does not exist")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if #param > param_maxlen then
|
||||||
|
minetest.chat_send_player(owner, "Command parameters are limited to max. " ..
|
||||||
|
param_maxlen .. " bytes.")
|
||||||
|
return
|
||||||
|
end
|
||||||
local has_privs, missing_privs = minetest.check_player_privs(owner, cmddef.privs)
|
local has_privs, missing_privs = minetest.check_player_privs(owner, cmddef.privs)
|
||||||
if not has_privs then
|
if not has_privs then
|
||||||
minetest.chat_send_player(owner, "You don't have permission "
|
minetest.chat_send_player(owner, "You don't have permission "
|
||||||
|
@ -11,6 +11,11 @@ mesecon.cooldown_granularity (Cooldown step length) float 0.5 0.0 1.0
|
|||||||
mesecon.blinky_plant_interval (Plant blinking interval) int 3 1 5
|
mesecon.blinky_plant_interval (Plant blinking interval) int 3 1 5
|
||||||
|
|
||||||
|
|
||||||
|
[mesecons_commandblock]
|
||||||
|
|
||||||
|
mesecon.commandblock_param_maxlen (Maximum command parameter length) int 10000 100 1000000
|
||||||
|
|
||||||
|
|
||||||
[mesecons_detector]
|
[mesecons_detector]
|
||||||
|
|
||||||
mesecon.detector_radius (Player detector scanning radius) int 6 3 16
|
mesecon.detector_radius (Player detector scanning radius) int 6 3 16
|
||||||
|
Loading…
Reference in New Issue
Block a user