param: pre-emptively correct use of str_list_make_v3 in lib/param
authorGarming Sam <garming@catalyst.net.nz>
Thu, 13 Mar 2014 00:27:24 +0000 (13:27 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 7 Jul 2014 21:32:35 +0000 (23:32 +0200)
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 <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
lib/param/loadparm.c
source3/param/loadparm.c

index 42dbacebd2b0ed6b7fdbfb9acc8ebb2ebeab1c96..c90ac053531af6b72a3f0b37210251f9cbfa63c7 100644 (file)
@@ -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] == '+' &&
index 0b6a2a4124e678119ebed9afa75046bc75f77e32..e1f52fdfe5c8a2cc44a8948c68390972798dfe14 100644 (file)
@@ -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] == '+' &&