1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-22 02:50:28 +03:00

s4-libregistry: Fix path check and improve while loops.

Reviewed-by: David Disseldorp <ddiss@samba.org>
This commit is contained in:
Andreas Schneider 2013-02-25 15:13:19 +01:00 committed by David Disseldorp
parent 2aca90b9a0
commit cab969d5ec

View File

@ -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,