use strtok_r in code that could plausibly be used from multi-threaded applications
authorChristian Grothoff <christian@grothoff.org>
Thu, 19 Mar 2020 18:40:34 +0000 (19:40 +0100)
committerChristian Grothoff <christian@grothoff.org>
Thu, 19 Mar 2020 18:40:34 +0000 (19:40 +0100)
src/util/strings.c

index 981718e4c088e1003971cf69b4f2c486b7474dd3..ac9805cdd79b749d413d3b9904a104af3073ac63 100644 (file)
@@ -266,11 +266,14 @@ convert_with_table (const char *input,
   const char *tok;
   unsigned long long last;
   unsigned int i;
+  char *sptr;
 
   ret = 0;
   last = 0;
   in = GNUNET_strdup (input);
-  for (tok = strtok (in, " "); tok != NULL; tok = strtok (NULL, " "))
+  for (tok = strtok_r (in, " ", &sptr);
+       tok != NULL;
+       tok = strtok_r (NULL, " ", &sptr))
   {
     do
     {