Fix buffer overflow in init(8) tokenizer.

This commit is contained in:
Jonas 'Sortie' Termansen 2024-05-23 11:42:33 +02:00
parent 29b375dcb1
commit da24b330e0
1 changed files with 2 additions and 1 deletions

View File

@ -949,8 +949,9 @@ static char** tokenize(size_t* out_tokens_used, const char* string)
bool singly = false;
bool doubly = false;
bool escaped = false;
for ( char c = *string++; c; c = *string++ )
while ( *string )
{
char c = *string++;
if ( !escaped && !singly && !doubly && isspace((unsigned char) c) )
break;
if ( !escaped && !doubly && c == '\'' )