mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-05-22 00:11:30 +02:00
52517: ensure that %H is followed by {
The previous code would accept any character after %H assuming it was a {, which was probably also a buffer overrun sometimes.
This commit is contained in:
parent
ec446a6f34
commit
653be0823d
2 changed files with 8 additions and 4 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
* 52516: Src/prompt.c: fix crash in %H when hlgroups is empty
|
||||
|
||||
* 52517: Src/prompt.c: ensure that %H is followed by {
|
||||
|
||||
2024-02-03 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* unposted: Util/printdefines: updates and fix omissions
|
||||
|
|
10
Src/prompt.c
10
Src/prompt.c
|
@ -605,10 +605,12 @@ putpromptchar(int doprint, int endchar)
|
|||
applytextattributes(TSC_PROMPT);
|
||||
break;
|
||||
case 'H':
|
||||
bv->fm = parsehighlight(bv->fm + 2, '}', &atr);
|
||||
if (atr != TXT_ERROR) {
|
||||
treplaceattrs(atr);
|
||||
applytextattributes(TSC_PROMPT);
|
||||
if (bv->fm[1] == '{') {
|
||||
bv->fm = parsehighlight(bv->fm + 2, '}', &atr);
|
||||
if (atr != TXT_ERROR) {
|
||||
treplaceattrs(atr);
|
||||
applytextattributes(TSC_PROMPT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
|
|
Loading…
Reference in a new issue