51670: prevent possible underflow in gettext()

This commit is contained in:
Bart Schaefer 2023-04-22 14:40:23 -07:00
parent ba3631b414
commit 858b8de3d7
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2023-04-22 Bart Schaefer <schaefer@zsh.org>
* 51670: Src/text.c: prevent possible underflow in gettext()
2023-04-18 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 51663: Completion/Unix/Command/_ssh: fix a typo in 51582

View File

@ -335,7 +335,7 @@ getjobtext(Eprog prog, Wordcode c)
tlim = tptr + JOBTEXTSIZE - 1;
tjob = 1;
gettext2(&s);
if (tptr[-1] == Meta)
if (tptr > jbuf && tptr[-1] == Meta)
--tptr;
*tptr = '\0';
freeeprog(prog); /* mark as unused */