Use strtok_r() instead of strtok()

This commit is contained in:
Todd C. Miller
2015-06-19 12:35:51 -06:00
parent 048e251ae0
commit e2328479dd
14 changed files with 47 additions and 32 deletions

View File

@@ -125,13 +125,15 @@ group_plugin_load(char *plugin_info)
}
}
if (ac != 0) {
char *last;
argv = malloc(ac * sizeof(char *));
if (argv == NULL) {
perror(NULL);
return -1;
}
ac = 0;
for ((cp = strtok(args, " \t")); cp; (cp = strtok(NULL, " \t")))
for ((cp = strtok_r(args, " \t", &last)); cp != NULL; (cp = strtok_r(NULL, " \t", &last)))
argv[ac++] = cp;
}
}