diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-11-22 23:38:33 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-11-22 23:38:33 +0000 |
commit | b38f7b6d1734234bf48fd173c36a685c61bbadf7 (patch) | |
tree | 2ef0a5894ddb2c50a0bf5d6828cfbb5cd8ede0fa /src/gui/gui-common.c | |
parent | 163ded5658ab4ddae6d82c5b842a2b65d593d024 (diff) | |
download | weechat-b38f7b6d1734234bf48fd173c36a685c61bbadf7.zip |
Fixed potential bug in printf internal function
Diffstat (limited to 'src/gui/gui-common.c')
-rw-r--r-- | src/gui/gui-common.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c index db601c635..fcf67a074 100644 --- a/src/gui/gui-common.c +++ b/src/gui/gui-common.c @@ -856,7 +856,7 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes seconds = time (NULL); date_tmp = localtime (&seconds); - pos = buf2 - 1; + pos = buf2; while (pos) { if ((!buffer->last_line) || (buffer->line_complete)) @@ -923,10 +923,15 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes } gui_add_to_line (buffer, MSG_TYPE_TIME, " "); } - gui_add_to_line (buffer, type, pos + 1); - pos = strchr (pos + 1, '\n'); - if (pos && !pos[1]) - pos = NULL; + gui_add_to_line (buffer, type, pos); + pos = strchr (pos, '\n'); + if (pos) + { + if (!pos[1]) + pos = NULL; + else + pos++; + } } } else |