From 0475211bdcf97be1690023016ce127727e2cc5fa Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 8 Jan 2009 16:49:31 -0800 Subject: [PATCH] Use strtok_r() instead of strtok(). Not a bug but a style issue, since this code doesn't call and isn't called by other code that uses strtok(). Found by Chris Eagle via Fortify. --- utilities/dpctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities/dpctl.c b/utilities/dpctl.c index 99065141..c6de5a1e 100644 --- a/utilities/dpctl.c +++ b/utilities/dpctl.c @@ -786,7 +786,7 @@ str_to_flow(char *string, struct ofp_match *match, uint8_t *table_idx, uint16_t *out_port, uint16_t *priority, uint16_t *idle_timeout, uint16_t *hard_timeout) { - + char *save_ptr = NULL; char *name; uint32_t wildcards; @@ -823,8 +823,8 @@ str_to_flow(char *string, struct ofp_match *match, } memset(match, 0, sizeof *match); wildcards = OFPFW_ALL; - for (name = strtok(string, "=, \t\r\n"); name; - name = strtok(NULL, "=, \t\r\n")) { + for (name = strtok_r(string, "=, \t\r\n", &save_ptr); name; + name = strtok_r(NULL, "=, \t\r\n", &save_ptr)) { const struct protocol *p; if (parse_protocol(name, &p)) { @@ -838,7 +838,7 @@ str_to_flow(char *string, struct ofp_match *match, const struct field *f; char *value; - value = strtok(NULL, ", \t\r\n"); + value = strtok_r(NULL, ", \t\r\n", &save_ptr); if (!value) { ofp_fatal(0, "field %s missing value", name); } -- 2.30.2