From 1de20d65a8a347f7f5078cf5c2f950a9486ca5e7 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 8 Jan 2021 22:15:48 +0000 Subject: [PATCH] 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. --- NEWS | 5 +++++ src/cmd/ksh93/edit/edit.c | 3 ++- src/cmd/ksh93/include/edit.h | 2 +- src/cmd/ksh93/include/version.h | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9fa489b83e35..2a2f5af01ec4 100644 --- a/NEWS +++ b/NEWS @@ -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}. diff --git a/src/cmd/ksh93/edit/edit.c b/src/cmd/ksh93/edit/edit.c index 0f23b3103570..e19a7d2775aa 100644 --- a/src/cmd/ksh93/edit/edit.c +++ b/src/cmd/ksh93/edit/edit.c @@ -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