aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDorian Wouters <elementw@openmailbox.org>2016-08-04 00:41:54 +0200
committerest31 <est31@users.noreply.github.com>2016-08-04 00:41:54 +0200
commitfca8e53842718f7f23e11587ae6235c072892b97 (patch)
treef7849e065c4cbb8628ffcfff60c1ee37c9080f5b
parent4ec667190967591727294ebbca0a38259fc006c7 (diff)
downloadminetest-fca8e53842718f7f23e11587ae6235c072892b97.tar.gz
minetest-fca8e53842718f7f23e11587ae6235c072892b97.tar.bz2
minetest-fca8e53842718f7f23e11587ae6235c072892b97.zip
Fix l_request_insecure_environment not ignoring all whitespace (#4395)
l_request_insecure_environment didn't ignore all whitespace in the secure.trusted_mods config option. Replaces std::remove with std::remove_if and the isspace function.
-rw-r--r--src/script/lua_api/l_util.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp
index d090fc91c..95a5fc4d1 100644
--- a/src/script/lua_api/l_util.cpp
+++ b/src/script/lua_api/l_util.cpp
@@ -446,8 +446,9 @@ int ModApiUtil::l_request_insecure_environment(lua_State *L)
// Check secure.trusted_mods
const char *mod_name = lua_tostring(L, -1);
std::string trusted_mods = g_settings->get("secure.trusted_mods");
- trusted_mods.erase(std::remove(trusted_mods.begin(),
- trusted_mods.end(), ' '), trusted_mods.end());
+ trusted_mods.erase(std::remove_if(trusted_mods.begin(),
+ trusted_mods.end(), static_cast<int(*)(int)>(&std::isspace)),
+ trusted_mods.end());
std::vector<std::string> mod_list = str_split(trusted_mods, ',');
if (std::find(mod_list.begin(), mod_list.end(), mod_name) ==
mod_list.end()) {