Permalink
Browse files

CUser::AddCTCPReply(): Reject CTCP requests containing spaces

CTCP requests can't contain spaces so it's useless to specify rules for those.

This doesn't affect any of the existing callers because those use Token(0) for
generating the first argument to this function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information...
1 parent 4ed833a commit e7fc8fa907ee7841372285de57118844abf0f883 @psychon psychon committed Feb 18, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 User.cpp
View
@@ -1253,10 +1253,14 @@ void CUser::SetIRCNick(const CNick& n) {
}
bool CUser::AddCTCPReply(const CString& sCTCP, const CString& sReply) {
+ // Reject CTCP requests containing spaces
+ if (sCTCP.find_first_of(' ') != CString::npos) {
+ return false;
+ }
+ // Reject empty CTCP requests
if (sCTCP.empty()) {
return false;
}
-
m_mssCTCPReplies[sCTCP.AsUpper()] = sReply;
return true;
}

0 comments on commit e7fc8fa

Please sign in to comment.