From 72651f92f0d35c026978e765cd9f8e0867c44af3 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Thu, 13 Mar 2014 13:27:24 +1300 Subject: [PATCH] param: pre-emptively correct use of str_list_make_v3 in lib/param lib/param uses str_list_make, while, s3 uses str_list_make_v3. These differ slightly and should be made the same. Notably it returns NULL when given a null or empty string Also, includes the null check in s3 code to be consistent for merging this section of code later on. Change-Id: Ib543a5a5307e06989621ea16bfe87e315d66a7ef Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett Reviewed-by: Nadezhda Ivanova --- lib/param/loadparm.c | 4 ++++ source3/param/loadparm.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 42dbacebd2b..c90ac053531 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -1470,6 +1470,10 @@ bool set_variable_helper(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr, { char **new_list = str_list_make(mem_ctx, pszParmValue, NULL); + if (new_list == NULL) { + break; + } + for (i=0; new_list[i]; i++) { if (*(const char ***)parm_ptr != NULL && new_list[i][0] == '+' && diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 0b6a2a4124e..e1f52fdfe5c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2688,6 +2688,10 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue { char **new_list = str_list_make_v3(mem_ctx, pszParmValue, NULL); + if (new_list == NULL) { + break; + } + for (i=0; new_list[i]; i++) { if (*(const char ***)parm_ptr != NULL && new_list[i][0] == '+' && -- 2.11.4.GIT