CSM: Fix itemstack:get_meta() 'metadata' indexing error
authorSmallJoker <mk939@ymail.com>
Wed, 26 Jun 2019 17:37:14 +0000 (19:37 +0200)
committerSmallJoker <mk939@ymail.com>
Sat, 14 Sep 2019 17:42:30 +0000 (19:42 +0200)
src/script/cpp_api/s_security.cpp
src/script/scripting_client.cpp

index d972be980178abeb9b4eb23ceab0da27623a724d..b90b3aa2ca1c2a73b6196289eee589fd9d6b457c 100644 (file)
@@ -243,6 +243,7 @@ void ScriptApiSecurity::initializeSecurityClient()
                "rawset",
                "select",
                "setfenv",
+               // getmetatable can be used to escape the sandbox
                "setmetatable",
                "tonumber",
                "tostring",
index 239c98e57ee412e76b43661acea43dec0f9eedad..c3e0ca373bb1adb8b9564ad70e987e328383b4f3 100644 (file)
@@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "lua_api/l_client.h"
 #include "lua_api/l_env.h"
 #include "lua_api/l_item.h"
+#include "lua_api/l_itemstackmeta.h"
 #include "lua_api/l_minimap.h"
 #include "lua_api/l_modchannels.h"
 #include "lua_api/l_particles_local.h"
@@ -67,6 +68,7 @@ ClientScripting::ClientScripting(Client *client):
 void ClientScripting::InitializeModApi(lua_State *L, int top)
 {
        LuaItemStack::Register(L);
+       ItemStackMetaRef::Register(L);
        StorageRef::Register(L);
        LuaMinimap::Register(L);
        NodeMetaRef::RegisterClient(L);