Add missing comment for the offset argument of tokenize. Add error checko on the offset.
This commit is contained in:
@@ -221,7 +221,7 @@ char *strpbrk(const char *string, const char *control)
|
||||
int tokenize(const char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen)
|
||||
{
|
||||
// If we reached the end of the parsed string, stop.
|
||||
if (string[*offset] == 0) {
|
||||
if ((*offset >= buflen) || (string[*offset] == 0)) {
|
||||
return 0;
|
||||
}
|
||||
// Keep copying character until we either reach 1) the end of the buffer, 2) a
|
||||
|
||||
Reference in New Issue
Block a user