commit 9c6827519c6fd93265c6b556ec847628c7e28634
parent 78d33aa6bda6afccaf56fc3a302681ca0df2256e
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 19 Mar 2020 19:17:31 +0100
conservatively use strtok_r
Diffstat:
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/lib/sync_api_download.c b/src/lib/sync_api_download.c
@@ -192,18 +192,21 @@ handle_header (char *buffer,
char *ndup;
const char *hdr_type;
char *hdr_val;
+ char *sp;
ndup = GNUNET_strndup (buffer,
total);
- hdr_type = strtok (ndup,
- ":");
+ hdr_type = strtok_r (ndup,
+ ":",
+ &sp);
if (NULL == hdr_type)
{
GNUNET_free (ndup);
return total;
}
- hdr_val = strtok (NULL,
- "\n\r");
+ hdr_val = strtok_r (NULL,
+ "\n\r",
+ &sp);
if (NULL == hdr_val)
{
GNUNET_free (ndup);
diff --git a/src/lib/sync_api_upload.c b/src/lib/sync_api_upload.c
@@ -197,18 +197,21 @@ handle_header (char *buffer,
char *ndup;
const char *hdr_type;
char *hdr_val;
+ char *sp;
ndup = GNUNET_strndup (buffer,
total);
- hdr_type = strtok (ndup,
- ":");
+ hdr_type = strtok_r (ndup,
+ ":",
+ &sp);
if (NULL == hdr_type)
{
GNUNET_free (ndup);
return total;
}
- hdr_val = strtok (NULL,
- "");
+ hdr_val = strtok_r (NULL,
+ "",
+ &sp);
if (NULL == hdr_val)
{
GNUNET_free (ndup);