This commit is contained in:
Arigadam 2026-10-11 13:12:12 +03:00
parent cc07193c23
commit 155ce36531
5 changed files with 114 additions and 18 deletions

View file

@ -149,7 +149,10 @@ get_next_token(void)
nextptr = ptr;
do {
++nextptr;
} while(*nextptr != '"');
} while(*nextptr != '"' && *nextptr != 0);
if(*nextptr == 0) {
return TOKENIZER_ERROR; /* unterminated string */
}
++nextptr;
return TOKENIZER_STRING;
} else {
@ -240,8 +243,8 @@ tokenizer_string(char *dest, int len)
return;
}
string_len = string_end - ptr - 1;
if(len < string_len) {
string_len = len;
if(len - 1 < string_len) {
string_len = len - 1;
}
memcpy(dest, ptr + 1, string_len);
dest[string_len] = 0;