summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_mapgen.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-09-05 20:08:51 -0400
committerShadowNinja <shadowninja@minetest.net>2015-05-16 18:32:31 -0400
commit3a8c7888807e4483bbdb3edd81c9893f3e2f427d (patch)
tree81f339e5f61b03e8d7842e06f034d09bf59dba96 /src/script/lua_api/l_mapgen.cpp
parentf26421228bbd31f02bf16b45a4b82be84f233e52 (diff)
downloadminetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.tar.gz
minetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.tar.bz2
minetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.zip
Add mod security
Due to compatibility concerns, this is temporarily disabled.
Diffstat (limited to 'src/script/lua_api/l_mapgen.cpp')
-rw-r--r--src/script/lua_api/l_mapgen.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index d94f902c4..dc3644e1c 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "lua_api/l_vmanip.h"
#include "common/c_converter.h"
#include "common/c_content.h"
+#include "cpp_api/s_security.h"
#include "util/serialize.h"
#include "server.h"
#include "environment.h"
@@ -1031,6 +1032,10 @@ int ModApiMapgen::l_generate_decorations(lua_State *L)
int ModApiMapgen::l_create_schematic(lua_State *L)
{
INodeDefManager *ndef = getServer(L)->getNodeDefManager();
+
+ const char *filename = luaL_checkstring(L, 4);
+ CHECK_SECURE_PATH_OPTIONAL(L, filename);
+
Map *map = &(getEnv(L)->getMap());
Schematic schem;
@@ -1069,8 +1074,6 @@ int ModApiMapgen::l_create_schematic(lua_State *L)
}
}
- const char *filename = luaL_checkstring(L, 4);
-
if (!schem.getSchematicFromMap(map, p1, p2)) {
errorstream << "create_schematic: failed to get schematic "
"from map" << std::endl;