mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- strtok() did not terminate properly if the last token in the string
did not end with a separator character but with a '\0' byte. Fixed. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14760 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
- strtok() did not terminate properly if the last token in the string
|
||||
did not end with a separator character but with a '\0' byte. Fixed.
|
||||
|
||||
- The directory scanning functions opendir/closedir did not get the global
|
||||
directory data tracking data structure initialized which later led to
|
||||
Enforcer hits and maybe trashed memory. Fixed.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_strtok.c,v 1.1.1.1 2004-07-26 16:32:20 obarthel Exp $
|
||||
* $Id: string_strtok.c,v 1.2 2004-10-25 19:53:15 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -89,9 +89,12 @@ strtok(char *str, const char *separator_set)
|
||||
goto out;
|
||||
|
||||
/* This is where the search can resume later. */
|
||||
last = &str[size+1];
|
||||
if((*last) == '\0')
|
||||
last = NULL;
|
||||
last = &str[size];
|
||||
|
||||
/* If we didn't hit the end of the string already,
|
||||
skip the separator. */
|
||||
if((*last) != '\0')
|
||||
last++;
|
||||
|
||||
/* This is the token we found; make sure that
|
||||
it looks like a valid string. */
|
||||
|
||||
Reference in New Issue
Block a user