summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/util_reg.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/source3/lib/util_reg.c b/source3/lib/util_reg.c
index eccd26dc34..ca46f86f69 100644
--- a/source3/lib/util_reg.c
+++ b/source3/lib/util_reg.c
@@ -76,39 +76,23 @@ const char *reg_type_lookup(enum winreg_Type type)
WERROR reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len,
uint32 *num_values, char ***values)
{
- const smb_ucs2_t *p = (const smb_ucs2_t *)buf;
- *num_values = 0;
+ DATA_BLOB blob;
+ const char **vals;
+ int i;
- /*
- * Make sure that a talloc context for the strings retrieved exists
- */
+ blob = data_blob_const((uint8_t *)buf, len);
- if (!(*values = TALLOC_ARRAY(mem_ctx, char *, 1))) {
+ if (!pull_reg_multi_sz(mem_ctx, &blob, &vals)) {
return WERR_NOMEM;
}
- len /= 2; /* buf is a set of UCS2 strings */
-
- while (len > 0) {
- char *val;
- size_t dstlen, thislen;
-
- thislen = strnlen_w(p, len) + 1;
- if (!convert_string_talloc(*values, CH_UTF16LE, CH_UNIX,
- p, thislen*2, (void *)&val, &dstlen, true)) {
- TALLOC_FREE(*values);
- return WERR_NOMEM;
- }
-
- ADD_TO_ARRAY(*values, char *, val, values, num_values);
- if (*values == NULL) {
- return WERR_NOMEM;
- }
-
- p += thislen;
- len -= thislen;
+ for (i=0; vals[i]; i++) {
+ ;;
}
+ *num_values = i;
+ *values = (char **)vals;
+
return WERR_OK;
}