diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 10 | ||||
-rw-r--r-- | src/socket.cpp | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 0514723a0..88021374b 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1414,17 +1414,11 @@ class TreeSocket : public InspSocket } /* Handle ERROR command */ - bool Error(std::deque<std::string> params) + bool Error(std::deque<std::string> ¶ms) { if (params.size() < 1) return false; - std::string Errmsg = params[0]; - std::string SName = myhost; - if (InboundServerName != "") - { - SName = InboundServerName; - } - Srv->SendOpers("*** ERROR from "+SName+": "+Errmsg); + WriteOpers("*** ERROR from %s: %s",(InboundServerName != "" ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); /* we will return false to cause the socket to close. */ return false; diff --git a/src/socket.cpp b/src/socket.cpp index 550783aed..4528090d4 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -209,15 +209,17 @@ std::string InspSocket::GetIP() char* InspSocket::Read() { + if ((n < 0) || (n > MAX_DESCRIPTOR)) + return NULL; int n = recv(this->fd,this->ibuf,sizeof(this->ibuf),0); - if (n > 0) + if ((n > 0) && (n <= sizeof(this->ibuf))) { ibuf[n] = 0; return ibuf; } else { - if (n == EAGAIN) + if (errno == EAGAIN) { return ""; } |