From 7dd7e845843d2189e9c0c4b113cc7ec6efc80371 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 3 Feb 2006 17:52:37 +0000 Subject: Extra safety checks git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3057 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/helperfuncs.cpp | 12 ++++++------ 1 file 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)) { -- cgit v1.2.3