Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6-1]: src/lib/libcurses Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/95e9e4806894
branches:  netbsd-6-1
changeset: 775868:95e9e4806894
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Sep 26 14:21:00 2013 +0000

description:
Pull up following revision(s) (requested by dsainty in ticket #960):
        lib/libcurses/setterm.c: revision 1.51
Fix a NULL dereference if the exit_alt_charset_mode capability is not
defined.
The previous version of this file changed a terminal initialisation test on
the exit_attribute_mode capability, checking for the exit_alt_charset_mode
capability as a substring, rather than performing a search for the
hard-coded
^O character.
That works better on terminals where ^O is not the correct value for
exit_alt_charset_mode.  But it works worse on terminals that don't have a
definition specified for exit_alt_charset_mode.
For example:
% TERMCAP='xterm:me=\E[m:' TERM=xterm vi
segmentation fault (core dumped)  TERMCAP='xterm:me=\E[m:' TERM=xterm vi
The crash can be avoided (without fixing the bug) by defining
exit_alt_charset_mode:
% TERMCAP='xterm|:me=\E[m:ae=:' TERM=xterm vi
ex/vi: Error: xterm: No such process
We now test exit_alt_charset_mode for NULL before continuing with the fatal
test, restoring the original no-crash behaviour.
XXX does_ctrl_o() is now just a naive reimplementation of strstr(), so
should
probably just use strstr() instead.

diffstat:

 lib/libcurses/setterm.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r e1227fed7f6c -r 95e9e4806894 lib/libcurses/setterm.c
--- a/lib/libcurses/setterm.c   Thu Sep 26 02:01:46 2013 +0000
+++ b/lib/libcurses/setterm.c   Thu Sep 26 14:21:00 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setterm.c,v 1.48.4.1 2013/05/11 21:48:23 riz Exp $     */
+/*     $NetBSD: setterm.c,v 1.48.4.1.2.1 2013/09/26 14:21:00 riz Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setterm.c  8.8 (Berkeley) 10/25/94";
 #else
-__RCSID("$NetBSD: setterm.c,v 1.48.4.1 2013/05/11 21:48:23 riz Exp $");
+__RCSID("$NetBSD: setterm.c,v 1.48.4.1.2.1 2013/09/26 14:21:00 riz Exp $");
 #endif
 #endif /* not lint */
 
@@ -172,6 +172,7 @@
         * It might turn off ACS, so check for that.
         */
        if (t_exit_attribute_mode(screen->term) != NULL &&
+           t_exit_alt_charset_mode(screen->term) != NULL &&
            does_ctrl_o(t_exit_attribute_mode(screen->term),
            t_exit_alt_charset_mode(screen->term)))
                screen->mask_me = 0;



Home | Main Index | Thread Index | Old Index