summaryrefslogtreecommitdiff
path: root/src/modules/m_ident.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_ident.cpp')
-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);