1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

history: fix out-of-bounds read on retrieving empty line

Reproducer: Compile a ksh with AddressSanitizer. In that ksh, edit
the last command line with 'fc', insert an empty line at the start,
and save. Now use the up-arrow to retrieve the empty line. Ksh
aborts on history.c line 1011 as hist_copy() tries to read before
the beginning of the buffer pointed to by s1.

src/cmd/ksh93/edit/history.c: hist_copy():
- Verify that the s1 pointer was increased from the original s1
  before trying to read the character *(s1-1).
This commit is contained in:
Martijn Dekker 2022-07-10 20:12:10 +02:00
parent 893ea066f7
commit 7a01d6df47
3 changed files with 8 additions and 3 deletions

4
NEWS
View file

@ -3,6 +3,10 @@ For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0
Any uppercase BUG_* names are modernish shell bug IDs.
2022-07-10:
- Fixed a potential crash on retrieving an empty line from the command history.
2022-07-09:
- Fixed a bug that broke '[[ ... ]]' test expressions for the command