From 653be0823da9a6b085a0092ac3a7b8792afc142a Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 4 Feb 2024 16:44:21 +0100 Subject: 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. --- Src/prompt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Src') diff --git a/Src/prompt.c b/Src/prompt.c index b1e5041bd..0d674ceab 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 '[': -- cgit 1.4.1