Package: libncurses5 Version: 5.7+20081213-1 Severity: normal Tags: patch
Hello, When porting an own application using ncurses from an old 5.5 version to a current 5.7 (i.e. on a Debian Lenny system), I found a bug related to free of screens (the application manages multiple terminals) : when the close of terminals was in the same order they was created, the application segfaulted or looped indefinitely. I identified the bug in the delscreen() function, and more precisely in delink_screen() where the global list of screens is incorrectly updated. I've successfully tested my application with the simple patch attached. This bug is also present in Squeeze and Sid. It has been fixed upstream in 2010/4/24 (last version of Sid is 20100313), I checked this with upstream authors (T. Dickey). It would be nice if the patch could be integrated in next Lenny release (if an y) and also in coming Squeeze. Thanks, Fred. -- System Information: Debian Release: 5.0.6 APT prefers lenny APT policy: (990, 'lenny'), (990, 'stable'), (800, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libncurses5 depends on: ii libc6 2.7-18lenny4 GNU C Library: Shared libraries Versions of packages libncurses5 recommends: ii libgpm2 1.20.4-3.1 General Purpose Mouse - shared lib libncurses5 suggests no packages. -- no debconf information
diff -Naur ncurses-5.7+20081213/ncurses/base/lib_set_term.c ncurses-5.7+20081213mod/ncurses/base/lib_set_term.c --- ncurses-5.7+20081213/ncurses/base/lib_set_term.c 2008-08-04 20:11:12.000000000 +0200 +++ ncurses-5.7+20081213mod/ncurses/base/lib_set_term.c 2010-09-17 11:13:37.000000000 +0200 @@ -106,7 +106,7 @@ for (each_screen(temp)) { if (temp == sp) { if (last) - last = sp->_next_screen; + last->_next_screen = sp->_next_screen; else _nc_screen_chain = sp->_next_screen; result = TRUE;