show_dir crashes on more than 200 columns



Hi,

A small fix to avoid a crash in show_dir() with a panel of more than 200
columns. Thanks to Vladimir.

(Jindrich, a g_malloc0 and a free of tmp[] seem rather redundant here.)

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research

--- src/screen.c.000	2004-09-26 00:02:15.000000000 +0200
+++ src/screen.c	2004-11-03 14:14:10.000000000 +0100
@@ -728,7 +728,7 @@ mini_info_separator (WPanel *panel)
 static void
 show_dir (WPanel *panel)
 {
-    char tmp[200];
+    char tmp[MC_MAXPATHLEN];
 
     set_colors (panel);
     draw_double_box (panel->widget.parent,
@@ -751,7 +751,7 @@ show_dir (WPanel *panel)
     widget_move (&panel->widget, 0, 3);
 
     trim (strip_home_and_password (panel->cwd), tmp,
-	  max (panel->widget.cols - 7, 0));
+	  min(max(panel->widget.cols - 7, 0), MC_MAXPATHLEN - 1));
     addstr (tmp);
     widget_move (&panel->widget, 0, 1);
     addstr ("<");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]