diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/userprocess.cpp | 6 | ||||
-rw-r--r-- | src/users.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index a72d738c3..dd6a4c24d 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -107,7 +107,7 @@ void InspIRCd::ProcessUser(userrec* cu) } else { - current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over 512chars) Please shorten it.", current->nick); + current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over %d chars) Please shorten it.", current->nick, MAXBUF-2); current->recvq = ""; } } @@ -177,8 +177,8 @@ void InspIRCd::ProcessUser(userrec* cu) std::string single_line = current->GetBuffer(); current->bytes_in += single_line.length(); current->cmds_in++; - if (single_line.length() > 512) - single_line.resize(512); + if (single_line.length() > MAXBUF - 2) /* MAXBUF is 514 to allow for neccessary line terminators */ + single_line.resize(MAXBUF - 2); /* So to trim to 512 here, we use MAXBUF - 2 */ EventHandler* old_comp = this->SE->GetRef(currfd); diff --git a/src/users.cpp b/src/users.cpp index cf3d4aa86..eacbe2779 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -690,8 +690,8 @@ void userrec::AddWriteBuf(const std::string &data) try { - if (data.length() > 512) - sendq.append(data.substr(0,510)).append("\r\n"); + if (data.length() > MAXBUF - 2) /* MAXBUF has a value of 514, to account for line terminators */ + sendq.append(data.substr(0,MAXBUF - 4)).append("\r\n"); /* MAXBUF-4 = 510 */ else sendq.append(data); } |