diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-02-12 20:05:50 -0500 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-02-12 20:05:50 -0500 |
commit | aa601daf67ca220290e03608fbaa4bcddbfcfbd8 (patch) | |
tree | a0759c06b939c90e8bed4d1af84e832bbbf0b842 /mesecons_luacontroller | |
parent | ce806489e2472c29bb6f32b0ec59f7e023f11c08 (diff) | |
download | dreambuilder_modpack-aa601daf67ca220290e03608fbaa4bcddbfcfbd8.tar dreambuilder_modpack-aa601daf67ca220290e03608fbaa4bcddbfcfbd8.tar.gz dreambuilder_modpack-aa601daf67ca220290e03608fbaa4bcddbfcfbd8.tar.bz2 dreambuilder_modpack-aa601daf67ca220290e03608fbaa4bcddbfcfbd8.tar.xz dreambuilder_modpack-aa601daf67ca220290e03608fbaa4bcddbfcfbd8.zip |
update boost_cart, homedecor, mesecons, moretrees, unified_inventory, and worldedit
Diffstat (limited to 'mesecons_luacontroller')
-rw-r--r-- | mesecons_luacontroller/init.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index 7d76b26..d874fdf 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -273,9 +273,25 @@ end local function get_digiline_send(pos) if not digiline then return end return function(channel, msg) + -- Make sure channel is string, number or boolean + if (type(channel) ~= "string" and type(channel) ~= "number" and type(channel) ~= "boolean") then + return false + end + + -- It is technically possible to send functions over the wire since + -- the high performance impact of stripping those from the data has + -- been decided to not be worth the added realism. + -- Make sure serialized version of the data is not insanely long to + -- prevent DoS-like attacks + local msg_ser = minetest.serialize(msg) + if #msg_ser > mesecon.setting("luacontroller_digiline_maxlen", 50000) then + return false + end + minetest.after(0, function() digiline:receptor_send(pos, digiline.rules.default, channel, msg) end) + return true end end @@ -284,6 +300,7 @@ local safe_globals = { "assert", "error", "ipairs", "next", "pairs", "select", "tonumber", "tostring", "type", "unpack", "_VERSION" } + local function create_environment(pos, mem, event) -- Gather variables for the environment local vports = minetest.registered_nodes[minetest.get_node(pos).name].virtual_portstates |