From 2e20f1147c70a86b1583613ac99fdb01af042256 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 21 Jun 2001 23:33:12 +0000 Subject: use next_token instead of strtok. single elemnts of list cannot be longer than a pstring (1024B now) (This used to be commit 72b749ec89fa3642c0b3330a5331be645f84e24c) --- source3/param/loadparm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source3') 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; } -- cgit