From 17fe68de7265f7bb1007255d80eb3d310ebd4e53 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 19 Jul 2008 23:19:23 +0000 Subject: Fix the 4-byte read madness discovered by psychon git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10045 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspsocket.cpp | 6 +++--- src/userprocess.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index d4e7e93e7..c12494503 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -392,7 +392,7 @@ const char* BufferedSocket::Read() return NULL; int n = 0; - char *ReadBuffer = Instance->GetReadBuffer(); + char* ReadBuffer = Instance->GetReadBuffer(); if (this->IsIOHooked) { @@ -400,7 +400,7 @@ const char* BufferedSocket::Read() int MOD_RESULT = 0; try { - MOD_RESULT = Instance->Config->GetIOHook(this)->OnRawSocketRead(this->fd, ReadBuffer, sizeof(ReadBuffer) - 1,result2); + MOD_RESULT = Instance->Config->GetIOHook(this)->OnRawSocketRead(this->fd, ReadBuffer, Instance->Config->NetBufferSize, result2); } catch (CoreException& modexcept) { @@ -418,7 +418,7 @@ const char* BufferedSocket::Read() } else { - n = recv(this->fd, ReadBuffer, sizeof(ReadBuffer) - 1, 0); + n = recv(this->fd, ReadBuffer, Instance->Config->NetBufferSize, 0); } /* diff --git a/src/userprocess.cpp b/src/userprocess.cpp index ca151520c..91dd9f76a 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -53,7 +53,7 @@ void ProcessUserHandler::Call(User* cu) try { - MOD_RESULT = cu->io->OnRawSocketRead(cu->GetFd(),ReadBuffer,Server->Config->NetBufferSize,result2); + MOD_RESULT = cu->io->OnRawSocketRead(cu->GetFd(), ReadBuffer, Server->Config->NetBufferSize, result2); } catch (CoreException& modexcept) { @@ -71,7 +71,7 @@ void ProcessUserHandler::Call(User* cu) } else { - result = cu->ReadData(ReadBuffer, sizeof(ReadBuffer)); + result = cu->ReadData(ReadBuffer, Server->Config->NetBufferSize); } if ((result) && (result != -EAGAIN)) -- cgit v1.2.3