diff options
author | Andreas Schneider <asn@samba.org> | 2013-02-25 15:13:19 +0100 |
---|---|---|
committer | David Disseldorp <ddiss@suse.de> | 2013-03-05 23:30:03 +0100 |
commit | cab969d5ec67b1b3afbd4be2ff3a0d3cec45fd45 (patch) | |
tree | a0c262680097160a34a7343833375dfa937af9f4 /source4/lib | |
parent | 2aca90b9a00e0727d640c235ef71a9a8b0c5fdca (diff) | |
download | samba-cab969d5ec67b1b3afbd4be2ff3a0d3cec45fd45.tar.gz samba-cab969d5ec67b1b3afbd4be2ff3a0d3cec45fd45.tar.bz2 samba-cab969d5ec67b1b3afbd4be2ff3a0d3cec45fd45.zip |
s4-libregistry: Fix path check and improve while loops.
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/registry/local.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 98791743ae..79c398b68a 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -80,7 +80,7 @@ static WERROR local_open_key(TALLOC_CTX *mem_ctx, const char **elements = NULL; int el; - if (path == NULL) { + if (path == NULL || path[0] == '\0') { return WERR_INVALID_PARAM; } @@ -103,7 +103,7 @@ static WERROR local_open_key(TALLOC_CTX *mem_ctx, el = 0; } - while (curbegin != NULL && *curbegin) { + do { if (curend != NULL) *curend = '\0'; elements = talloc_realloc(mem_ctx, elements, const char *, el+2); @@ -124,7 +124,7 @@ static WERROR local_open_key(TALLOC_CTX *mem_ctx, break; curbegin = curend + 1; curend = strchr(curbegin, '\\'); - } + } while (curbegin != NULL && curbegin[0] != '\0'); talloc_free(orig); *result = reg_import_hive_key(local_parent->global.context, curkey, @@ -184,7 +184,7 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx, const char **elements = NULL; int el; - if (path == NULL) { + if (path == NULL || path[0] == '\0') { return WERR_INVALID_PARAM; } @@ -207,7 +207,7 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx, el = 0; } - while (curbegin != NULL && *curbegin) { + do { if (curend != NULL) *curend = '\0'; elements = talloc_realloc(mem_ctx, elements, const char *, el+2); @@ -233,7 +233,7 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx, break; curbegin = curend + 1; curend = strchr(curbegin, '\\'); - } + } while (curbegin != NULL && curbegin[0] != '\0'); talloc_free(orig); *result = reg_import_hive_key(local_parent->global.context, curkey, |