From 60d92db9a1b71bbfd4230c5eb9f04cd6a87a41d8 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 11 Sep 2017 15:22:40 +0100 Subject: Add ModeParser::IsModeChar to standardise mode validation. --- src/configreader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index cc478b9b6..005730dca 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -487,8 +487,8 @@ void ServerConfig::Fill() std::string modes = ConfValue("disabled")->getString("usermodes"); for (std::string::const_iterator p = modes.begin(); p != modes.end(); ++p) { - // Complain when the character is not a-z or A-Z - if ((*p < 'A') || (*p > 'z') || ((*p < 'a') && (*p > 'Z'))) + // Complain when the character is not a valid mode character. + if (!ModeParser::IsModeChar(*p)) throw CoreException("Invalid usermode " + std::string(1, *p) + " was found."); DisabledUModes[*p - 'A'] = 1; } @@ -497,7 +497,7 @@ void ServerConfig::Fill() modes = ConfValue("disabled")->getString("chanmodes"); for (std::string::const_iterator p = modes.begin(); p != modes.end(); ++p) { - if ((*p < 'A') || (*p > 'z') || ((*p < 'a') && (*p > 'Z'))) + if (!ModeParser::IsModeChar(*p)) throw CoreException("Invalid chanmode " + std::string(1, *p) + " was found."); DisabledCModes[*p - 'A'] = 1; } -- cgit v1.3.1-10-gc9f91