From 360660947b8137fba78981932de6b503b9889e62 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sun, 30 Nov 2014 19:01:37 -0500 Subject: LuaSettings: Sanitize setting name strings --- src/settings.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/settings.cpp') diff --git a/src/settings.cpp b/src/settings.cpp index 9485c7d74..34348cc06 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -63,6 +63,16 @@ Settings & Settings::operator = (const Settings &other) } +std::string Settings::sanitizeString(const std::string &value) +{ + std::string str = value; + for (const char *s = "\t\n\v\f\r\b =\""; *s; s++) + str.erase(std::remove(str.begin(), str.end(), *s), str.end()); + + return str; +} + + std::string Settings::getMultiline(std::istream &is) { std::string value; -- cgit v1.2.3