From a3300d5b5967eb98295ea9ba10fe063b8c758887 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 26 Jul 2020 12:59:49 +0200 Subject: [PATCH] fix parser crash from turn 1179 --- src/util/parser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/parser.c b/src/util/parser.c index e0f6aeb67..7e2ac665e 100644 --- a/src/util/parser.c +++ b/src/util/parser.c @@ -147,7 +147,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen) char *cursor = lbuf; char quotechar = 0; bool escape = false; - const char *ctoken = *str; + const char *ctoken = *str, *cstart; if (!ctoken) { return 0; @@ -159,6 +159,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen) } return 0; } + cstart = ctoken; while (*ctoken) { wint_t wc; size_t len; @@ -190,7 +191,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen) ++ctoken; break; } - else if (quotechar == 0) { + else if (quotechar == 0 && cstart == ctoken) { quotechar = utf8_character; ++ctoken; }