Package: ncmpc
Version: 0.11.1+svn-r3965-2
Tags: patch

When one sets "timedisplay-type = remaining" in the config,
ncmpc will crash with a strange looking libc memory corruption
error.

I found the reason to be the initialisation of the variable
options.timedisplay_type in src/options.c:371, which  does not
work as expected, if at all.

When one sets "timedisplay-type = remaining" in the config, the
g_free() in src/conf.c:477 fails because there is no memory
allocated but options.timedisplay_type != NULL, this gives
the libc errors.

The solution is to use g_strdup() to allocate the memory for
the string.  I have attached a patch vs. the current svn
revision (7398), but it applied to the debian sources as well.

I also sent this report to upstream, but there was no action (yet):

http://www.musicpd.org/mantis/view.php?id=1720

Cheers,
Stefan.
diff -dupr ncmpc.svn/src/options.c ncmpc.fix/src/options.c
--- ncmpc.svn/src/options.c	2006-06-29 16:07:25.000000000 +0200
+++ ncmpc.fix/src/options.c	2008-08-08 14:49:16.000000000 +0200
@@ -368,7 +368,7 @@ options_init( void )
   options.crossfade_time = DEFAULT_CROSSFADE_TIME;
   options.seek_time = 1;
   options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0);
-  options.timedisplay_type = DEFAULT_TIMEDISPLAY_TYPE;
+  options.timedisplay_type = g_strdup(DEFAULT_TIMEDISPLAY_TYPE);
   
   return &options;
 }

Reply via email to