mirror of
https://git.busybox.net/busybox.git
synced 2024-11-27 15:43:26 +08:00
lineedit: fix crash when icanon set with -echo
When icanon is set with -echo (e.g. ssh from an emacs shell) then S.state will remain null but later it will be deferenced causing ash to crash. Fix: additional check on state. Signed-off-by: Akos Somfai <akos.somfai@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
550e6d8fbd
commit
853cfe927f
@ -254,7 +254,7 @@ static NOINLINE const char *get_homedir_or_NULL(void)
|
||||
const char *home;
|
||||
|
||||
# if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH
|
||||
home = state->sh_get_var ? state->sh_get_var("HOME") : getenv("HOME");
|
||||
home = state && state->sh_get_var ? state->sh_get_var("HOME") : getenv("HOME");
|
||||
# else
|
||||
home = getenv("HOME");
|
||||
# endif
|
||||
@ -2038,7 +2038,7 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
||||
if (!cwd_buf) {
|
||||
const char *home;
|
||||
# if EDITING_HAS_sh_get_var
|
||||
cwd_buf = state->sh_get_var
|
||||
cwd_buf = state && state->sh_get_var
|
||||
? xstrdup(state->sh_get_var("PWD"))
|
||||
: xrealloc_getcwd_or_warn(NULL);
|
||||
# else
|
||||
|
Loading…
Reference in New Issue
Block a user