diff options
author | Simo Sorce <idra@samba.org> | 2001-06-21 23:33:12 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-06-21 23:33:12 +0000 |
commit | 2e20f1147c70a86b1583613ac99fdb01af042256 (patch) | |
tree | 67a34bec07c869be6274a5245aecf11a21c06a9a /source3/param | |
parent | 460c9061909de2715eb1ff6737402d017e346d66 (diff) | |
download | samba-2e20f1147c70a86b1583613ac99fdb01af042256.tar.gz samba-2e20f1147c70a86b1583613ac99fdb01af042256.tar.bz2 samba-2e20f1147c70a86b1583613ac99fdb01af042256.zip |
use next_token instead of strtok.
single elemnts of list cannot be longer than a pstring (1024B now)
(This used to be commit 72b749ec89fa3642c0b3330a5331be645f84e24c)
Diffstat (limited to 'source3/param')
-rw-r--r-- | source3/param/loadparm.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index edda04c36b..1527dd1e69 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -3677,13 +3677,14 @@ char *lp_printername(int snum) char **lp_list_make(char *string) { char **list, **rlist; - char *str; - char *tok; + char *str, *s; int num, lsize; + pstring tok; if (!string || !*string) return NULL; - str = strdup(string); + s = strdup(string); if (!str || !*str) return NULL; + str = s; list = (char**)malloc(((sizeof(char**)) * P_LIST_ABS)); if (!list) { @@ -3695,9 +3696,9 @@ char **lp_list_make(char *string) num = 0; - for (tok = strtok(str, LIST_SEP); tok; tok = strtok(NULL, LIST_SEP)) + while (*str) { - if (!*tok) continue; + if (!next_token(&str, tok, LIST_SEP, sizeof(pstring))) continue; if ((num +1) == lsize) { lsize += P_LIST_ABS; @@ -3721,7 +3722,7 @@ char **lp_list_make(char *string) num++; } - free (str); + free (s); return list; } |