1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
$NetBSD: patch-ag,v 1.3 2008/07/06 05:16:50 tonnerre Exp $
--- source/parse.c.orig 2008-07-06 06:24:53.000000000 +0200
+++ source/parse.c
@@ -1413,10 +1413,11 @@ static void p_mode(char *from, char **Ar
char *channel;
char *line;
int flag;
+ size_t linelen;
ChannelList *chan = NULL;
ChannelList *chan2 = get_server_channels(from_server);
- char buffer[BIG_BUFFER_SIZE+1];
+ char *buffer;
char *smode;
#ifdef COMPRESS_MODES
char *tmpbuf = NULL;
@@ -1432,7 +1433,13 @@ static void p_mode(char *from, char **Ar
set_display_target(channel, LOG_CRAP);
if (channel && line)
{
- strcpy(buffer, line);
+ buffer = malloc(linelen = strlen(line));
+ if (!buffer)
+ {
+ perror("malloc");
+ return;
+ }
+ strncpy(buffer, line, linelen);
if (get_int_var(MODE_STRIPPER_VAR))
strip_modes(from,channel,line);
if (is_channel(channel))
@@ -1486,6 +1493,7 @@ static void p_mode(char *from, char **Ar
do_logchannel(LOG_MODE_USER, chan, "%s %s %s", from, channel, line);
}
update_all_status(current_window, NULL, 0);
+ free(buffer);
}
#ifdef GUI
gui_update_nicklist(channel);
|