mirror of
https://github.com/minetest/minetest.git
synced 2024-12-28 08:57:30 +01:00
Settings: Disallow space characters entirely
Lua API: > Setting names can't contain whitespace or any of ="{}#
This commit is contained in:
parent
e2f8f4da83
commit
f1f9361bc8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user