Skip to content

Commit 1de20d6

Browse files
committed
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.
1 parent 86fc4c6 commit 1de20d6

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ For full details, see the git log at: https://github.com/ksh93/ksh
33

44
Any uppercase BUG_* names are modernish shell bug IDs.
55

6+
2021-01-08:
7+
8+
- Fixed a crash on exceeding the maximum size of the $PS1 prompt.
9+
The maximum size is also increased from 160 to 256 bytes.
10+
611
2021-01-07:
712

813
- Fixed a crash that could occur while ksh updated ${.sh.match}.

src/cmd/ksh93/edit/edit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,8 @@ void ed_setup(register Edit_t *ep, int fd, int reedit)
658658
{
659659
int skip=0;
660660
ep->e_crlf = 0;
661-
*pp++ = c;
661+
if(pp<ppmax)
662+
*pp++ = c;
662663
for(n=1; c = *last++; n++)
663664
{
664665
if(pp < ppmax)

src/cmd/ksh93/include/edit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#endif /* SHOPT_MULTIBYTE */
6060

6161
#define TABSIZE 8
62-
#define PRSIZE 160
62+
#define PRSIZE 256
6363
#define MAXLINE 1024 /* longest edit line permitted */
6464

6565
typedef struct _edit_pos

src/cmd/ksh93/include/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */
2222
#define SH_RELEASE_SVER "1.0.0-alpha" /* semantic version number: https://semver.org */
23-
#define SH_RELEASE_DATE "2021-01-07" /* must be in this format for $((.sh.version)) */
23+
#define SH_RELEASE_DATE "2021-01-08" /* must be in this format for $((.sh.version)) */
2424

2525
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
2626
/* Arithmetic $((.sh.version)) uses the last 10 chars, so the date must be at the end. */

0 commit comments

Comments
 (0)