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

Fix crash on long PS1 prompt (Solaris patch 195-17824699)

Original report and info:
https://www.mail-archive.com/ast-developers@lists.research.att.com/msg01677.html
https://www.mail-archive.com/ast-developers@lists.research.att.com/msg01679.html

Patch pulled in from:
https://raw.githubusercontent.com/oracle/solaris-userland/master/components/ksh93/patches/195-17824699.patch

src/cmd/ksh93/edit/edit.c: ed_setup():
- Prevent the ed_setup() function from writing past ep->e_prompt,
  which is set to the local char prompt[PRSIZE] variable in
  ed_emacsread().

src/cmd/ksh93/include/edit.h:
- Increase maximum prompt size, PRSIZE, to 256.
This commit is contained in:
Martijn Dekker 2021-01-08 22:15:48 +00:00
parent 86fc4c6d0a
commit 1de20d65a8
4 changed files with 9 additions and 3 deletions

5
NEWS
View file

@ -3,6 +3,11 @@ For full details, see the git log at: https://github.com/ksh93/ksh
Any uppercase BUG_* names are modernish shell bug IDs.
2021-01-08:
- Fixed a crash on exceeding the maximum size of the $PS1 prompt.
The maximum size is also increased from 160 to 256 bytes.
2021-01-07:
- Fixed a crash that could occur while ksh updated ${.sh.match}.

View file

@ -658,7 +658,8 @@ void ed_setup(register Edit_t *ep, int fd, int reedit)
{
int skip=0;
ep->e_crlf = 0;
*pp++ = c;
if(pp<ppmax)
*pp++ = c;
for(n=1; c = *last++; n++)
{
if(pp < ppmax)

View file

@ -59,7 +59,7 @@
#endif /* SHOPT_MULTIBYTE */
#define TABSIZE 8
#define PRSIZE 160
#define PRSIZE 256
#define MAXLINE 1024 /* longest edit line permitted */
typedef struct _edit_pos

View file

@ -20,7 +20,7 @@
#define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */
#define SH_RELEASE_SVER "1.0.0-alpha" /* semantic version number: https://semver.org */
#define SH_RELEASE_DATE "2021-01-07" /* must be in this format for $((.sh.version)) */
#define SH_RELEASE_DATE "2021-01-08" /* must be in this format for $((.sh.version)) */
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
/* Arithmetic $((.sh.version)) uses the last 10 chars, so the date must be at the end. */