diff --git a/NEWS b/NEWS index 8a184a8f3e67..f4fa45b04fc5 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ This documents significant changes in the dev branch of ksh 93u+m. For full details, see the git log at: https://github.com/ksh93/ksh Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library. +2024-01-05: + +- Fixed a potential crash on pressing Ctrl+C on the command line while + history expansion (the -H or histexpand option) is active. + 2023-12-28: - Fixed intermittent incorrect behaviour (a race condition), introduced on diff --git a/src/cmd/ksh93/sh/io.c b/src/cmd/ksh93/sh/io.c index b580871eb362..9f171dc7fa6c 100644 --- a/src/cmd/ksh93/sh/io.c +++ b/src/cmd/ksh93/sh/io.c @@ -2014,7 +2014,7 @@ static ssize_t slowread(Sfio_t *iop,void *buff,size_t size,Sfdisc_t *handle) sh_timerdel(timeout); timeout=0; #if SHOPT_HISTEXPAND - if(rsize && *(char*)buff != '\n' && sh.nextprompt==1 && sh_isoption(SH_HISTEXPAND)) + if(rsize > 0 && *(char*)buff != '\n' && sh.nextprompt==1 && sh_isoption(SH_HISTEXPAND)) { int r; ((char*)buff)[rsize] = '\0';