]> jfr.im git - irc/quakenet/newserv.git/commitdiff
overflow in G's welcome command
authorPaul <redacted>
Sat, 30 Aug 2008 17:22:33 +0000 (18:22 +0100)
committerPaul <redacted>
Sat, 30 Aug 2008 17:22:33 +0000 (18:22 +0100)
helpmod2/hchannel.h
helpmod2/hcommands.c

index 9e6ffdcce276322d2ef2bd18e3301752f21c626a..b760e69e8d60d6fefb0b5b05bcf765ee414644d1 100644 (file)
@@ -55,10 +55,12 @@ enum
 
 #define HCHANNEL_CONF_COUNT 21
 
+#define HCHANNEL_WELCOME_LEN 400
+
 typedef struct hchannel_struct
 {
     channel *real_channel;
-    char welcome[400];
+    char welcome[HCHANNEL_WELCOME_LEN];
     int flags;
 
     int jf_control; /* join flood control */
index 3f44409c2769d84e049ee99115dbc51934206cbf..39f63041710bb54917abecc072549dc565b23833 100644 (file)
@@ -5,6 +5,8 @@
 #include <sys/types.h>
 #include <dirent.h>
 
+#include "../lib/strlfunc.h"
+
 #include "hcommands.h"
 #include "hcommand.h"
 
@@ -766,7 +768,7 @@ static void helpmod_cmd_welcome (huser *sender, channel* returntype, char* ostr,
     }
     else
     {
-        strcpy(hchan->welcome, ostr);
+        strlcpy(hchan->welcome, ostr, HCHANNEL_WELCOME_LEN);
         helpmod_reply(sender, returntype, "Welcome message for channel %s (%s) is now: %s", hchan->real_channel->index->name->content, hchannel_get_state(hchan, H_WELCOME), hchan->welcome);
     }
 }