summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/ldb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 5f1a06c501..46b340da88 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -991,12 +991,13 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
unsigned int i;
struct ldb_message_element *el;
- *max_subkeynamelen = 0;
-
for (i = 0; i < kd->subkey_count; i++) {
el = ldb_msg_find_element(kd->subkeys[i], "key");
*max_subkeynamelen = MAX(*max_subkeynamelen, el->values[0].length);
}
+
+ /* for UTF16 encoding */
+ *max_subkeynamelen *= 2;
}
if (max_valnamelen != NULL || max_valbufsize != NULL) {
@@ -1004,12 +1005,6 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
struct ldb_message_element *el;
W_ERROR_NOT_OK_RETURN(cache_values(kd));
- if (max_valbufsize != NULL)
- *max_valbufsize = 0;
-
- if (max_valnamelen != NULL)
- *max_valnamelen = 0;
-
for (i = 0; i < kd->value_count; i++) {
if (max_valnamelen != NULL) {
el = ldb_msg_find_element(kd->values[i], "value");
@@ -1026,6 +1021,11 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
talloc_free(data.data);
}
}
+
+ if (max_valnamelen != NULL) {
+ /* for UTF16 encoding */
+ *max_valnamelen *= 2;
+ }
}
return WERR_OK;