summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-14 17:08:11 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-14 17:08:11 +0000
commitabbe8b23a66b7e32430877b2cd068fdad4bf087e (patch)
treee3ae1be799a4d3b57b7a7caa43a4627db997e70f /src
parent9c4231a274d6d801d6a14f83a80e6ab76c9e0554 (diff)
More careful checks for control characters and linefeeds in the ident (because having them in there really does stuff things up)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1091 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_ident.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index d2d73f805..2a15dbf28 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -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);