]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ident.cpp
More careful checks for control characters and linefeeds in the ident (because having...
[user/henk/code/inspircd.git] / src / modules / m_ident.cpp
index d2d73f805ac584cf074fe685f59585a3c42be7f5..2a15dbf28e4ff65dd4827f2a4062dd031c48075b 100644 (file)
@@ -169,12 +169,10 @@ class RFC1413
                                                                        if (section)
                                                                        {
                                                                                while ((*section == ' ') && (strlen(section)>0)) section++; // strip leading spaces
-                                                                               if ((section[strlen(section)-1] == 13) || (section[strlen(section)-1] == 10))
-                                                                                       section[strlen(section)-1] = '\0'; // strip carriage returns
-                                                                               if ((section[strlen(section)-1] == 13) || (section[strlen(section)-1] == 10))
-                                                                                       section[strlen(section)-1] = '\0'; // strip linefeeds
-                                                                               while ((section[strlen(section)-1] == ' ') && (strlen(section)>0)) // strip trailing spaces
-                                                                                       section[strlen(section)-1] = '\0';
+                                                                               int t = strlen(section);
+                                                                               for (int j = 0; j < t; j++)
+                                                                                       if ((section[j] < 33) || (section[j]>126))
+                                                                                               section[j] = '\0'; // truncate at invalid chars
                                                                                if (strlen(section))
                                                                                {
                                                                                        strlcpy(u->ident,section,IDENTMAX);