diff options
| author | 2005-05-03 06:08:01 +0000 | |
|---|---|---|
| committer | 2005-05-03 06:08:01 +0000 | |
| commit | 87382eb7160d6e2a03465eb8118915d389ec661f (patch) | |
| tree | 5a5295b5749864bd0423eab52e966b4a03688bf2 /src/inspircd.cpp | |
| parent | A few cpu usage tweaks (diff) | |
| download | inspircd++-87382eb7160d6e2a03465eb8118915d389ec661f.tar.gz inspircd++-87382eb7160d6e2a03465eb8118915d389ec661f.tar.bz2 inspircd++-87382eb7160d6e2a03465eb8118915d389ec661f.zip | |
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/inspircd.cpp')
| -rw-r--r-- | src/inspircd.cpp | 10 |
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); |
