[CDMAKE][CTR] Fix strtok_s for empty strings. Part of Wine commit 4fa616c by Bernhard...
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Aug 2016 16:30:06 +0000 (16:30 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Aug 2016 16:30:06 +0000 (16:30 +0000)
svn path=/trunk/; revision=72406

reactos/sdk/lib/crt/string/strtok_s.c
reactos/sdk/tools/cdmake/cdmake.c

index 46a06cd..6e8b560 100644 (file)
@@ -18,7 +18,10 @@ char * CDECL strtok_s(char *str, const char *delim, char **ctx)
     while(*str && strchr(delim, *str))
         str++;
     if(!*str)
+    {
+        *ctx = str;
         return NULL;
+    }
 
     *ctx = str+1;
     while(**ctx && !strchr(delim, **ctx))
index 5f1db6e..d02ccc6 100644 (file)
@@ -1930,7 +1930,10 @@ char* strtok_s(char *str, const char *delim, char **ctx)
     while (*str && strchr(delim, *str))
         str++;
     if (!*str)
+    {
+        *ctx = str;
         return NULL;
+    }
 
     *ctx = str + 1;
     while (**ctx && !strchr(delim, **ctx))