From db11f2b24c6aeb5ab7ba4678638890bc68b1d0c1 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 29 Apr 2005 15:01:13 +0000 Subject: Fixed some flood checking added noticeall git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1262 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/users.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index 0ece63bc9..0d305a3b7 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -166,7 +166,7 @@ bool userrec::HasPermission(char* command) } -void userrec::AddBuffer(std::string a) +bool userrec::AddBuffer(std::string a) { std::string b = ""; for (int i = 0; i < a.length(); i++) @@ -175,6 +175,16 @@ void userrec::AddBuffer(std::string a) std::stringstream stream(recvq); stream << b; recvq = stream.str(); + int i = 0; + // count the size of the first line in the buffer. + while (i < recvq.length()) + { + if (recvq[i++] == '\n') + break; + } + // return false if we've had more than 600 characters WITHOUT + // a carriage return (this is BAD, drop the socket) + return (i < 600); } bool userrec::BufferIsReady() -- cgit v1.2.3