From abbe8b23a66b7e32430877b2cd068fdad4bf087e Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 14 Apr 2005 17:08:11 +0000 Subject: 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 --- src/modules/m_ident.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/modules') 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); -- cgit v1.2.3