From f1f9361bc80760b05c717f3e44697f0b7d2e073a Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 10 Jun 2019 18:17:57 +0200 Subject: Settings: Disallow space characters entirely Lua API: > Setting names can't contain whitespace or any of ="{}# --- src/settings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/settings.cpp') 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; -- cgit v1.2.3