* PATCH: ensure that %H is followed by {
@ 2024-02-04 15:46 Mikael Magnusson
0 siblings, 0 replies; only message in thread
From: Mikael Magnusson @ 2024-02-04 15:46 UTC (permalink / raw)
To: zsh-workers
The previous code would accept any character after %H assuming it
was a {, which was probably also a buffer overrun sometimes.
---
Src/prompt.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/Src/prompt.c b/Src/prompt.c
index b1e5041bd2..0d674ceab5 100644
--- a/Src/prompt.c
+++ b/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 '[':
--
2.38.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-04 15:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-04 15:46 PATCH: ensure that %H is followed by { Mikael Magnusson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).