diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-03 17:52:37 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-03 17:52:37 +0000 |
commit | 7dd7e845843d2189e9c0c4b113cc7ec6efc80371 (patch) | |
tree | c92ef64afe71fbbda51b90afcf7b1e0894cb29a6 /src/helperfuncs.cpp | |
parent | 65552575d61fd876749dd5aa2240d00f4e4f0903 (diff) |
Extra safety checks
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3057 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r-- | src/helperfuncs.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index e5b1c6773..454604303 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -125,7 +125,7 @@ void readfile(file_cache &F, const char* fname) void Write_NoFormat(int sock, const char *text) { - if ((sock < 0) || (!text)) + if ((sock < 0) || (!text) || (sock > MAX_DESCRIPTORS)) return; char tb[MAXBUF]; @@ -148,7 +148,7 @@ void Write_NoFormat(int sock, const char *text) void Write(int sock,char *text, ...) { - if (sock < 0) + if ((sock < 0) || (sock > MAX_DESCRIPTORS)) return; if (!text) { @@ -179,7 +179,7 @@ void Write(int sock,char *text, ...) void WriteServ_NoFormat(int sock, const char* text) { - if ((sock < 0) || (!text)) + if ((sock < 0) || (!text) || (sock > MAX_DESCRIPTORS)) return; char tb[MAXBUF]; int bytes = snprintf(tb,MAXBUF,":%s %s\r\n",Config->ServerName,text); @@ -203,7 +203,7 @@ void WriteServ_NoFormat(int sock, const char* text) void WriteServ(int sock, char* text, ...) { - if (sock < 0) + if ((sock < 0) || (sock > MAX_DESCRIPTORS)) return; if (!text) { @@ -234,7 +234,7 @@ void WriteServ(int sock, char* text, ...) void WriteFrom_NoFormat(int sock, userrec *user, const char* text) { - if ((sock < 0) || (!text) || (!user)) + if ((sock < 0) || (!text) || (!user) || (sock > MAX_DESCRIPTORS)) return; char tb[MAXBUF]; int bytes = snprintf(tb,MAXBUF,":%s %s\r\n",user->GetFullHost(),text); @@ -258,7 +258,7 @@ void WriteFrom_NoFormat(int sock, userrec *user, const char* text) void WriteFrom(int sock, userrec *user,char* text, ...) { - if (sock < 0) + if ((sock < 0) || (sock > MAX_DESCRIPTORS)) return; if ((!text) || (!user)) { |