mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
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.
This commit is contained in:
parent
4ec6671909
commit
fca8e53842
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user