fix endless loop in the quoted-string parsing

This commit is contained in:
Enno Rehling 2021-08-21 21:59:34 +02:00
parent 205cd6f491
commit 46ab8f3cb6
1 changed files with 3 additions and 3 deletions

View File

@ -195,18 +195,18 @@ char *parse_token(const char **str, char *lbuf, size_t buflen)
} }
else if (utf8_character == '"' || utf8_character == '\'') { else if (utf8_character == '"' || utf8_character == '\'') {
if (utf8_character == quotechar) { if (utf8_character == quotechar) {
++ctoken; quotechar = 0;
break; break;
} }
else if (quotechar == 0 && cstart == ctoken) { else if (quotechar == 0 && cstart == ctoken) {
quotechar = utf8_character; quotechar = utf8_character;
++ctoken;
} }
else { else {
if (cursor - buflen < lbuf - len) { if (cursor - buflen < lbuf - len) {
*cursor++ = *ctoken++; *cursor++ = *ctoken;
} }
} }
++ctoken;
} }
else if (utf8_character == SPACE_REPLACEMENT) { else if (utf8_character == SPACE_REPLACEMENT) {
if (cursor - buflen < lbuf - len) { if (cursor - buflen < lbuf - len) {