diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_registry.c | 2 | ||||
-rw-r--r-- | source3/utils/net_registry_util.c | 11 | ||||
-rw-r--r-- | source3/utils/net_registry_util.h | 2 | ||||
-rw-r--r-- | source3/utils/net_rpc_registry.c | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index f21a1603cf..8a45dec21c 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -41,7 +41,7 @@ static WERROR open_hive(TALLOC_CTX *ctx, const char *path, WERROR werr; NT_USER_TOKEN *token = NULL; char *hivename = NULL; - const char *tmp_subkeyname = NULL; + char *tmp_subkeyname = NULL; TALLOC_CTX *tmp_ctx = talloc_stackframe(); if ((hive == NULL) || (subkeyname == NULL)) { diff --git a/source3/utils/net_registry_util.c b/source3/utils/net_registry_util.c index b1d0c7765c..948f8b6153 100644 --- a/source3/utils/net_registry_util.c +++ b/source3/utils/net_registry_util.c @@ -72,9 +72,10 @@ void print_registry_value(const char *valname, * - strip trailing '\\' chars */ WERROR split_hive_key(TALLOC_CTX *ctx, const char *path, char **hivename, - const char **subkeyname) + char **subkeyname) { char *p; + const char *tmp_subkeyname; if ((path == NULL) || (hivename == NULL) || (subkeyname == NULL)) { return WERR_INVALID_PARAM; @@ -100,10 +101,14 @@ WERROR split_hive_key(TALLOC_CTX *ctx, const char *path, char **hivename, if ((p == NULL) || (*p == '\0')) { /* just the hive - no subkey given */ - *subkeyname = ""; + tmp_subkeyname = ""; } else { *p = '\0'; - *subkeyname = p+1; + tmp_subkeyname = p+1; + } + *subkeyname = talloc_strdup(ctx, tmp_subkeyname); + if (*subkeyname == NULL) { + return WERR_NOMEM; } return WERR_OK; diff --git a/source3/utils/net_registry_util.h b/source3/utils/net_registry_util.h index 5438f39946..13ec6ebfcd 100644 --- a/source3/utils/net_registry_util.h +++ b/source3/utils/net_registry_util.h @@ -34,6 +34,6 @@ void print_registry_value(const char *valname, * - strip trailing '\\' chars */ WERROR split_hive_key(TALLOC_CTX *ctx, const char *path, char **hivename, - const char **subkeyname); + char **subkeyname); #endif diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index 0d1f068862..92aaf06411 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -28,7 +28,7 @@ static bool reg_hive_key(TALLOC_CTX *ctx, const char *fullname, { WERROR werr; char *hivename = NULL; - const char *tmp_keyname = NULL; + char *tmp_keyname = NULL; bool ret = false; TALLOC_CTX *tmp_ctx = talloc_stackframe(); |