summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp6
1 files changed, 4 insertions, 2 deletions
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 "";
}