summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-11-25 21:34:55 +0100
committerGünther Deschner <gd@samba.org>2009-11-25 21:39:49 +0100
commit95108f1c60aaa0407aa4eb8c9a567e90302253c6 (patch)
tree207342c11b0d08f17cace4852ac11bdb41e2b3af /source3/lib
parentc438b2b3923db66672ec82e795eef543de5fcb8a (diff)
downloadsamba-95108f1c60aaa0407aa4eb8c9a567e90302253c6.tar.gz
samba-95108f1c60aaa0407aa4eb8c9a567e90302253c6.tar.bz2
samba-95108f1c60aaa0407aa4eb8c9a567e90302253c6.zip
s3-registry: fix REG_MULTI_SZ handling in registry_push_value.
Catched by smbconftort test on the buildfarm. Guenther
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_reg_api.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/source3/lib/util_reg_api.c b/source3/lib/util_reg_api.c
index 309fa62762..7150444cf6 100644
--- a/source3/lib/util_reg_api.c
+++ b/source3/lib/util_reg_api.c
@@ -161,12 +161,29 @@ WERROR registry_push_value(TALLOC_CTX *mem_ctx,
}
break;
}
- case REG_MULTI_SZ:
- if (!push_reg_multi_sz(mem_ctx, presult, (const char **)value->v.multi_sz.strings))
- {
+ case REG_MULTI_SZ: {
+ /* handle the case where we don't get a NULL terminated array */
+ const char **array;
+ int i;
+
+ array = talloc_array(mem_ctx, const char *,
+ value->v.multi_sz.num_strings + 1);
+ if (!array) {
+ return WERR_NOMEM;
+ }
+
+ for (i=0; i < value->v.multi_sz.num_strings; i++) {
+ array[i] = value->v.multi_sz.strings[i];
+ }
+ array[i] = NULL;
+
+ if (!push_reg_multi_sz(mem_ctx, presult, array)) {
+ talloc_free(array);
return WERR_NOMEM;
}
+ talloc_free(array);
break;
+ }
case REG_BINARY:
*presult = data_blob_talloc(mem_ctx,
value->v.binary.data,