string: fix strtok detecting NUL only after separators

This commit is contained in:
Lephenixnoir 2021-08-17 17:30:21 +02:00
parent ea35c18c41
commit a0ceeefaf4
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 1 additions and 1 deletions

View File

@ -12,7 +12,7 @@ char *strtok(char * restrict new_s, char const * restrict separators)
/* Skip non-delimiters */
char *token = s;
s += strcspn(s, separators);
*s++ = 0;
if(*s) *s++ = 0;
return token;
}