an edchar cannot conceivably be NUL, so set them to the default;
this is confirmed to help fix OS/2 and plugs an uninitialised read on systems without werase
This commit is contained in:
17
edit.c
17
edit.c
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.287 2015/07/05 19:37:13 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.288 2015/07/10 17:31:09 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in later versions we might use libtermcap for this, but since external
|
* in later versions we might use libtermcap for this, but since external
|
||||||
@ -3291,8 +3291,23 @@ x_mode(bool onoff)
|
|||||||
edchars.eof = tty_state.c_cc[VEOF];
|
edchars.eof = tty_state.c_cc[VEOF];
|
||||||
#ifdef VWERASE
|
#ifdef VWERASE
|
||||||
edchars.werase = tty_state.c_cc[VWERASE];
|
edchars.werase = tty_state.c_cc[VWERASE];
|
||||||
|
#else
|
||||||
|
edchars.werase = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!edchars.erase)
|
||||||
|
edchars.erase = CTRL('H');
|
||||||
|
if (!edchars.kill)
|
||||||
|
edchars.kill = CTRL('U');
|
||||||
|
if (!edchars.intr)
|
||||||
|
edchars.intr = CTRL('C');
|
||||||
|
if (!edchars.quit)
|
||||||
|
edchars.quit = CTRL('\\');
|
||||||
|
if (!edchars.eof)
|
||||||
|
edchars.eof = CTRL('D');
|
||||||
|
if (!edchars.werase)
|
||||||
|
edchars.werase = CTRL('W');
|
||||||
|
|
||||||
#ifdef _POSIX_VDISABLE
|
#ifdef _POSIX_VDISABLE
|
||||||
/* Convert unset values to internal 'unset' value */
|
/* Convert unset values to internal 'unset' value */
|
||||||
if (edchars.erase == _POSIX_VDISABLE)
|
if (edchars.erase == _POSIX_VDISABLE)
|
||||||
|
Reference in New Issue
Block a user