mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
vi mode: Disable = and tab at the start of the line (#521)
In vi mode, due to a buffer overflow, <ESC>= as the first input either produces an invalid completion or crashes the shell. The easiest fix is to disable <ESC>= as well as <TAB> completion at the start of the command line, as is already done in emacs mode. src/cmd/ksh93/edit/vi.c: - getline(): If cur_virt <= 0 in case '\t', beep and refuse tab completion. - textmod(): Move an 'if' statement checking for INVALID cur_virt to include = mode along with * and \ mode. Co-authored-by: Martijn Dekker <martijn@inlv.org> Resolves: https://github.com/ksh93/ksh/issues/520
This commit is contained in:
parent
d3a9da12df
commit
b6c8bb7b3c
4 changed files with 17 additions and 7 deletions
6
NEWS
6
NEWS
|
@ -2,6 +2,12 @@ This documents significant changes in the 1.0 branch of ksh 93u+m.
|
|||
For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0
|
||||
Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library.
|
||||
|
||||
2022-08-24:
|
||||
|
||||
- Fixed a bug that caused ksh in the vi editor mode to crash or produce
|
||||
invalid completions if ESC = was used at the beginning of a line. Both
|
||||
tab and = completions are now disabled at the start of the command line.
|
||||
|
||||
2022-08-20:
|
||||
|
||||
- Fixed a bug in command line options processing that caused short-form
|
||||
|
|
|
@ -1560,6 +1560,11 @@ static void getline(register Vi_t* vp,register int mode)
|
|||
}
|
||||
vp->ed->e_tabcount = 0;
|
||||
}
|
||||
if(cur_virt <= 0)
|
||||
{
|
||||
ed_ringbell();
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
fallback:
|
||||
|
@ -1581,7 +1586,6 @@ static void getline(register Vi_t* vp,register int mode)
|
|||
break;
|
||||
}
|
||||
refresh(vp,INPUT);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2540,10 +2544,10 @@ addin:
|
|||
/* FALLTHROUGH */
|
||||
case '*': /** do file name expansion in place **/
|
||||
case '\\': /** do file name completion in place **/
|
||||
case '=': /** list file name expansions **/
|
||||
if( cur_virt == INVALID )
|
||||
return(BAD);
|
||||
/* FALLTHROUGH */
|
||||
case '=': /** list file name expansions **/
|
||||
save_v(vp);
|
||||
i = last_virt;
|
||||
++last_virt;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */
|
||||
#define SH_RELEASE_SVER "1.0.3-alpha" /* semantic version number: https://semver.org */
|
||||
#define SH_RELEASE_DATE "2022-08-20" /* must be in this format for $((.sh.version)) */
|
||||
#define SH_RELEASE_DATE "2022-08-24" /* must be in this format for $((.sh.version)) */
|
||||
#define SH_RELEASE_CPYR "(c) 2020-2022 Contributors to ksh " SH_RELEASE_FORK
|
||||
|
||||
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
|
||||
|
|
|
@ -5581,10 +5581,10 @@ or
|
|||
character.
|
||||
.TP 10
|
||||
.BI ^I " tab"
|
||||
Attempts command or file name completion as described above
|
||||
and returns to input mode.
|
||||
If a partial completion occurs, repeating this will
|
||||
behave as if
|
||||
Except at the start of the line, attempts command or
|
||||
file name completion as described above and returns to
|
||||
input mode. If a partial completion occurs, repeating
|
||||
this will behave as if
|
||||
.B =
|
||||
were entered from control mode.
|
||||
If no match is found or entered after
|
||||
|
|
Loading…
Reference in a new issue