From dcad2fe327598a92e2ca51feeb462bda7a5fa7c9 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 16 Jul 2006 19:43:38 +0000 Subject: [PATCH] Fixing sendq crask git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4424 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/dnsqueue.cpp | 3 ++- src/users.cpp | 13 ++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index 9c74d726c..5572c3247 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -177,7 +177,8 @@ public: if (resolver2.GetFD() != -1) { dnslist[resolver2.GetFD()] = this; - user_fd_to_dns[usr->fd] = this; + if (usr) + user_fd_to_dns[usr->fd] = this; } } } diff --git a/src/users.cpp b/src/users.cpp index 10a0a0353..ef2a58fd5 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -405,25 +405,20 @@ bool userrec::AddBuffer(const std::string &a) } recvq.append(b); - unsigned int i = 0; - - // count the size of the first line in the buffer. - while (i < recvq.length()) - { - if (recvq[i++] == '\n') - break; - } + //unsigned int i = 0; + if (recvq.length() > (unsigned)this->recvqmax) { this->SetWriteError("RecvQ exceeded"); WriteOpers("*** User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->recvqmax); + return false; } /* * return false if we've had more than 600 characters WITHOUT * a carriage return (this is BAD, drop the socket) */ - return (i < 600); + return true; } bool userrec::BufferIsReady() -- 2.39.5