aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-12-04 18:26:05 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-12-04 18:26:05 +0200
commitabd106bacb1da0c3de909b1a289ed3fa21f2215d (patch)
tree9a1d6b5ab70cb4187c54dcd5c24d50793622423b /src
parent008de2fb8f4ed77e06ed499e2af8953df2bd1f43 (diff)
downloadminetest-abd106bacb1da0c3de909b1a289ed3fa21f2215d.tar.gz
minetest-abd106bacb1da0c3de909b1a289ed3fa21f2215d.tar.bz2
minetest-abd106bacb1da0c3de909b1a289ed3fa21f2215d.zip
Enforce modname naming convention
Diffstat (limited to 'src')
-rw-r--r--src/scriptapi.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index a88d6be5a..c759683ed 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -164,7 +164,7 @@ void check_modname_prefix(lua_State *L, std::string &name)
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"))
throw LuaError(L, std::string("Name \"")+name
+"\" does not follow naming conventions: "
- +"\"contains unallowed characters)");
+ +"\"contains unallowed characters");
}
static v3f readFloatPos(lua_State *L, int index)
@@ -2672,6 +2672,14 @@ bool scriptapi_loadmod(lua_State *L, const std::string &scriptpath,
{
ModNameStorer modnamestorer(L, modname);
+ if(!string_allowed(modname, "abcdefghijklmnopqrstuvwxyz"
+ "0123456789_")){
+ errorstream<<"Error loading mod \""<<modname
+ <<"\": modname does not follow naming conventions: "
+ <<"Only chararacters [a-z0-9_] are allowed."<<std::endl;
+ return false;
+ }
+
bool success = false;
try{