]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Standardise the characters allowed in config identifiers.
authorSadie Powell <sadie@witchery.services>
Thu, 27 Feb 2020 18:52:00 +0000 (18:52 +0000)
committerSadie Powell <sadie@witchery.services>
Thu, 5 Mar 2020 20:47:18 +0000 (20:47 +0000)
src/configparser.cpp

index 6fdc56c32dd45b7a5b9348651473865e5fc5327b..4748fa847a2b7c249fee0bad3c435adc80ea8b54 100644 (file)
@@ -158,12 +158,20 @@ struct Parser
                }
        }
 
+       bool wordchar(char ch)
+       {
+               return isalnum(ch)
+                       || ch == '-'
+                       || ch == '.'
+                       || ch == '_';
+       }
+
        void nextword(std::string& rv)
        {
                int ch = next();
                while (isspace(ch))
                        ch = next();
-               while (isalnum(ch) || ch == '_'|| ch == '-')
+               while (wordchar(ch))
                {
                        rv.push_back(ch);
                        ch = next();
@@ -205,7 +213,7 @@ struct Parser
                                while (1)
                                {
                                        ch = next();
-                                       if (isalnum(ch) || (varname.empty() && ch == '#') || ch == '.')
+                                       if (wordchar(ch) || (varname.empty() && ch == '#'))
                                                varname.push_back(ch);
                                        else if (ch == ';')
                                                break;