aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2019-06-10 18:17:57 +0200
committersfan5 <sfan5@live.de>2019-06-10 18:30:59 +0200
commitf1f9361bc80760b05c717f3e44697f0b7d2e073a (patch)
tree94da94dd2831ead66850d3500e6ca86efead640e
parente2f8f4da83206d551f9acebd14d574ea37ca214a (diff)
downloadminetest-f1f9361bc80760b05c717f3e44697f0b7d2e073a.tar.gz
minetest-f1f9361bc80760b05c717f3e44697f0b7d2e073a.tar.bz2
minetest-f1f9361bc80760b05c717f3e44697f0b7d2e073a.zip
Settings: Disallow space characters entirely
Lua API: > Setting names can't contain whitespace or any of ="{}#
-rw-r--r--src/settings.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 66c17e12d..876c63e7b 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -69,7 +69,9 @@ Settings & Settings::operator = (const Settings &other)
bool Settings::checkNameValid(const std::string &name)
{
bool valid = name.find_first_of("=\"{}#") == std::string::npos;
- if (valid) valid = trim(name) == name;
+ if (valid)
+ valid = std::find_if(name.begin(), name.end(), ::isspace) == name.end();
+
if (!valid) {
errorstream << "Invalid setting name \"" << name << "\""
<< std::endl;