X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_ident.cpp;h=f1c3b81fdebadb6e415533d47afe17b325c6815f;hb=1dfead3b2cc9e8c603f6ad6f7216576a2ce361fb;hp=93a3d6549b805ed0ea8cab5cc85ae724c233643e;hpb=fd20068a0bddf39b7464218997ccff37489608c9;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 93a3d6549..f1c3b81fd 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -235,14 +235,20 @@ class IdentRequestSocket : public EventHandler */ ibuf[recvresult] = '\0'; std::string buf(ibuf); - std::string::size_type lastcolon = buf.rfind(':'); - if (lastcolon == std::string::npos) + + /* <2 colons: invalid + * 2 colons: reply is an error + * >3 colons: there is a colon in the ident + */ + if (std::count(buf.begin(), buf.end(), ':') != 3) return; + std::string::size_type lastcolon = buf.rfind(':'); + /* Truncate the ident at any characters we don't like, skip leading spaces */ for (std::string::const_iterator i = buf.begin()+lastcolon+1; i != buf.end(); ++i) { - if (result.size()+1 == ServerInstance->Config->Limits.IdentMax) + if (result.size() == ServerInstance->Config->Limits.IdentMax) /* Ident is getting too long */ break;