1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

Fixed potential bug in printf internal function

This commit is contained in:
Sebastien Helleu
2005-11-22 23:38:33 +00:00
parent 163ded5658
commit b38f7b6d17
2 changed files with 20 additions and 10 deletions
+10 -5
View File
@@ -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
+10 -5
View File
@@ -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