From e7b05beb7d90b4ea53ef13da86ff8b8ccde1193b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 19 Aug 2021 20:14:22 +0200 Subject: Validate staticdata and object property length limits (#11511) Some games provide users with enough freedom to create items with metadata longer than 64KB, preventing this from causing issues is on them but we'll still do the minimum not to abort the server if this happens. --- src/script/lua_api/l_object.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/script/lua_api/l_object.cpp') diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 8e308cd9e..c404cb63c 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -685,6 +685,7 @@ int ObjectRef::l_set_properties(lua_State *L) return 0; read_object_properties(L, 2, sao, prop, getServer(L)->idef()); + prop->validate(); sao->notifyObjectPropertiesModified(); return 0; } @@ -752,6 +753,7 @@ int ObjectRef::l_set_nametag_attributes(lua_State *L) std::string nametag = getstringfield_default(L, 2, "text", ""); prop->nametag = nametag; + prop->validate(); sao->notifyObjectPropertiesModified(); lua_pushboolean(L, true); return 1; -- cgit v1.2.3