fix parser crash from turn 1179

This commit is contained in:
Enno Rehling 2020-07-26 12:59:49 +02:00
parent 233a142e0d
commit a3300d5b59

View file

@ -147,7 +147,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen)
char *cursor = lbuf; char *cursor = lbuf;
char quotechar = 0; char quotechar = 0;
bool escape = false; bool escape = false;
const char *ctoken = *str; const char *ctoken = *str, *cstart;
if (!ctoken) { if (!ctoken) {
return 0; return 0;
@ -159,6 +159,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen)
} }
return 0; return 0;
} }
cstart = ctoken;
while (*ctoken) { while (*ctoken) {
wint_t wc; wint_t wc;
size_t len; size_t len;
@ -190,7 +191,7 @@ char *parse_token(const char **str, char *lbuf, size_t buflen)
++ctoken; ++ctoken;
break; break;
} }
else if (quotechar == 0) { else if (quotechar == 0 && cstart == ctoken) {
quotechar = utf8_character; quotechar = utf8_character;
++ctoken; ++ctoken;
} }