From: Ben Pfaff Date: Fri, 9 Jan 2009 00:49:31 +0000 (-0800) Subject: Use strtok_r() instead of strtok(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0475211bdcf97be1690023016ce127727e2cc5fa;p=openvswitch 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. --- 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); }