]> pilppa.com Git - uci.git/commitdiff
use strsep instead of strtok to avoid a segfault
authorFelix Fietkau <nbd@openwrt.org>
Wed, 6 Feb 2008 14:47:04 +0000 (15:47 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 6 Feb 2008 14:47:04 +0000 (15:47 +0100)
util.c

diff --git a/util.c b/util.c
index 1d71335f7384d4e2149013686143048784784916..eb50b89c30792ac6983a736cc8cf2581d5616e9c 100644 (file)
--- a/util.c
+++ b/util.c
@@ -103,15 +103,15 @@ int uci_parse_tuple(struct uci_context *ctx, char *str, char **package, char **s
                last++;
        }
 
-       *package = strtok(str, ".");
+       *package = strsep(&str, ".");
        if (!*package || !uci_validate_name(*package))
                goto error;
 
-       *section = strtok(NULL, ".");
+       *section = strsep(&str, ".");
        if (!*section)
                goto lastval;
 
-       *option = strtok(NULL, ".");
+       *option = strsep(&str, ".");
        if (!*option)
                goto lastval;