summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-03 06:08:01 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-03 06:08:01 +0000
commit87382eb7160d6e2a03465eb8118915d389ec661f (patch)
tree5a5295b5749864bd0423eab52e966b4a03688bf2 /src
parent3a106c6ee4c8b2e7c2a7748fb6ce5f40dac96dbf (diff)
Extra safety checks to avoid trying to write() remote users
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1286 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index ff1a9e9da..a9e0e316f 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -591,7 +591,7 @@ void Write(int sock,char *text, ...)
va_end(argsPtr);
int bytes = snprintf(tb,MAXBUF,"%s\r\n",textbuffer);
chop(tb);
- if (sock != -1)
+ if ((sock != -1) && (sock != FD_MAGIC_NUMBER))
{
int MOD_RESULT = 0;
FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes > 512 ? 512 : bytes));
@@ -625,7 +625,7 @@ void WriteServ(int sock, char* text, ...)
va_end(argsPtr);
int bytes = snprintf(tb,MAXBUF,":%s %s\r\n",ServerName,textbuffer);
chop(tb);
- if (sock != -1)
+ if ((sock != -1) && (sock != FD_MAGIC_NUMBER))
{
int MOD_RESULT = 0;
FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes > 512 ? 512 : bytes));
@@ -659,7 +659,7 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
va_end(argsPtr);
int bytes = snprintf(tb,MAXBUF,":%s!%s@%s %s\r\n",user->nick,user->ident,user->dhost,textbuffer);
chop(tb);
- if (sock != -1)
+ if ((sock != -1) && (sock != FD_MAGIC_NUMBER))
{
int MOD_RESULT = 0;
FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes > 512 ? 512 : bytes));
@@ -873,7 +873,7 @@ void WriteCommon(userrec *u, char* text, ...)
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
- if (!already_sent[otheruser->fd])
+ if ((otheruser->fd > 0) && (!already_sent[otheruser->fd]))
{
already_sent[otheruser->fd] = 1;
WriteFrom(otheruser->fd,u,"%s",textbuffer);
@@ -925,7 +925,7 @@ void WriteCommonExcept(userrec *u, char* text, ...)
userrec* otheruser = (userrec*)o;
if (u != otheruser)
{
- if (!already_sent[otheruser->fd])
+ if ((otheruser->fd > 0) && (!already_sent[otheruser->fd]))
{
already_sent[otheruser->fd] = 1;
WriteFrom(otheruser->fd,u,"%s",textbuffer);