Skip to content

Commit

Permalink
Replace strtok_r with strtok in curl tool_getparam.c for portability.
Browse files Browse the repository at this point in the history
  • Loading branch information
icing committed Aug 3, 2023
1 parent 11cd45c commit 3e13028
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tool_getparam.c
Expand Up @@ -686,14 +686,16 @@ static CURLcode set_trace_config(struct GlobalConfig *global,
const char *config)
{
CURLcode result = CURLE_OK;
char *token, *tok_buf, *tmp, *name;
char *token, *tmp, *name;
bool toggle;

tmp = strdup(config);
if(!tmp)
return CURLE_OUT_OF_MEMORY;

token = strtok_r(tmp, ", ", &tok_buf);
/* Allow strtok() here since this isn't used threaded */
/* !checksrc! disable BANNEDFUNC 2 */
token = strtok(tmp, ", ");
while(token) {
switch(*token) {
case '-':
Expand Down Expand Up @@ -728,7 +730,7 @@ static CURLcode set_trace_config(struct GlobalConfig *global,
if(result)
goto out;
}
token = strtok_r(NULL, ", ", &tok_buf);
token = strtok(NULL, ", ");
}
out:
free(tmp);
Expand Down

0 comments on commit 3e13028

Please sign in to comment.