summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-03-04 09:04:53 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-03-04 09:04:53 +0000
commit0530039b9f5bd4eadc1a4f4dda202d3bd32908ee (patch)
treebac09ba8fd5e7dc1573c71cb2ab0cb3ca2357d4f /src/fe-common
parent5f0b432bebb0dbf509a4d7665615820a70c5ed61 (diff)
downloadirssi-0530039b9f5bd4eadc1a4f4dda202d3bd32908ee.zip
/SET names_max_width - buffer overflowed if it was too small..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1349 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/fe-channels.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c
index 1307a8ff..6459d6e7 100644
--- a/src/fe-common/core/fe-channels.c
+++ b/src/fe-common/core/fe-channels.c
@@ -339,7 +339,7 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
char *format, *stripped;
char *linebuf, nickmode[2] = { 0, 0 };
int *columns, cols, rows, last_col_rows, col, row, max_width;
- int item_extra;
+ int item_extra, linebuf_size;
window = window_find_closest(channel->server, channel->name,
MSGLEVEL_CLIENTCRAP);
@@ -381,7 +381,7 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
last_col_rows = rows;
str = g_string_new(NULL);
- linebuf = g_malloc(max_width+1);
+ linebuf_size = max_width+1; linebuf = g_malloc(linebuf_size);
col = 0; row = 0;
for (tmp = nicklist; tmp != NULL; tmp = tmp->next) {
@@ -389,6 +389,10 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
nickmode[0] = rec->op ? '@' : rec->voice ? '+' : ' ';
+ if (linebuf_size < columns[col]-item_extra+1) {
+ linebuf_size = (columns[col]-item_extra+1)*2;
+ linebuf = g_realloc(linebuf, linebuf_size);
+ }
memset(linebuf, ' ', columns[col]-item_extra);
linebuf[columns[col]-item_extra] = '\0';
memcpy(linebuf, rec->nick, strlen(rec->nick));