summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-29 15:01:13 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-29 15:01:13 +0000
commitdb11f2b24c6aeb5ab7ba4678638890bc68b1d0c1 (patch)
tree74480013c1ae951748073e505259a7d35fee8609 /src/users.cpp
parent96bf59631c7a17d9f0e99847a33df85a279aae4d (diff)
Fixed some flood checking
added noticeall git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1262 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp12
1 files changed, 11 insertions, 1 deletions
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()