* screen.c (show_dir): A small fix to avoid a crash in show_dir() with

a panel of more than 200 columns.
This commit is contained in:
Andrew V. Samoilov 2004-11-03 19:56:36 +00:00
parent 611114d735
commit 358f13f13d
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-11-04 Jindrich Novy <jnovy@redhat.com>
* screen.c (show_dir): A small fix to avoid a crash in show_dir() with
a panel of more than 200 columns.
2004-11-03 Andrew V. Samoilov <sav@bcs.zp.ua>
* file.c (make_symlink): Use g_strlcpy() instead of strcpy().

View File

@ -728,7 +728,7 @@ mini_info_separator (WPanel *panel)
static void
show_dir (WPanel *panel)
{
char tmp[200];
char *tmp;
set_colors (panel);
draw_double_box (panel->widget.parent,
@ -750,9 +750,13 @@ show_dir (WPanel *panel)
widget_move (&panel->widget, 0, 3);
tmp = g_malloc (panel->widget.cols + 1);
tmp[panel->widget.cols] = '\0';
trim (strip_home_and_password (panel->cwd), tmp,
max (panel->widget.cols - 7, 0));
min (max (panel->widget.cols - 7, 0), panel->widget.cols) );
addstr (tmp);
g_free (tmp);
widget_move (&panel->widget, 0, 1);
addstr ("<");
widget_move (&panel->widget, 0, panel->widget.cols - 2);