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:
tg 2015-07-10 17:31:09 +00:00
parent abfde383fe
commit 5613d6a04a

17
edit.c
View File

@ -28,7 +28,7 @@
#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
@ -3291,8 +3291,23 @@ x_mode(bool onoff)
edchars.eof = tty_state.c_cc[VEOF];
#ifdef VWERASE
edchars.werase = tty_state.c_cc[VWERASE];
#else
edchars.werase = 0;
#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
/* Convert unset values to internal 'unset' value */
if (edchars.erase == _POSIX_VDISABLE)