From: SmallJoker Date: Mon, 10 Jun 2019 16:17:57 +0000 (+0200) Subject: Settings: Disallow space characters entirely X-Git-Tag: 5.1.0~199 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f1f9361bc80760b05c717f3e44697f0b7d2e073a;p=oweals%2Fminetest.git Settings: Disallow space characters entirely Lua API: > Setting names can't contain whitespace or any of ="{}# --- 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;