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

Fix more bugs that occur when enabling ASan (#293)

src/cmd/ksh93/{bltins/typeset,sh/name,sh/nvtree,sh/nvtype}.c:
- Replace more instances of memcmp with strncmp to fix
  heap-buffer-overflow errors when running the regression tests
  with ASan enabled.

src/cmd/ksh93/edit/vi.c:
- Fix an invalid dereference of the 'p' pointer to fix a crash in
  vi mode when entering a comment in the command history. This
  bugfix was backported from ksh2020:
  https://github.com/att/ast/issues/798

src/cmd/ksh93/tests/pty.sh:
- Add a regression test for the vi mode crash.
This commit is contained in:
Johnothan King 2021-05-01 20:06:30 -07:00 committed by GitHub
parent 88a1f3d661
commit 1aec9b06dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 5 deletions

View file

@ -826,5 +826,20 @@ w :\E_
r ^:test-2: : One\\ "Two Three"\$'Four Five'\.mp3\r\n$
!
# err_exit #
((SHOPT_VSH)) && tst $LINENO <<"!"
L crash when entering comment into history file (vi mode)
# https://github.com/att/ast/issues/798
d 15
p :test-1:
c foo \E#
r ^:test-1: #foo\r\n$
w hist -lnN 1
r ^:test-2: hist -lnN 1\r\n$
r \t#foo\r\n$
r \thist -lnN 1\r\n$
!
# ======
exit $((Errors<125?Errors:125))