diff options
Diffstat (limited to 'source3/lib/util_reg_api.c')
-rw-r--r-- | source3/lib/util_reg_api.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/source3/lib/util_reg_api.c b/source3/lib/util_reg_api.c index 60031d97d3..8f28e9c282 100644 --- a/source3/lib/util_reg_api.c +++ b/source3/lib/util_reg_api.c @@ -91,16 +91,15 @@ WERROR registry_pull_value(TALLOC_CTX *mem_ctx, goto error; } - value->v.sz.len = convert_string_talloc( - value, CH_UTF16LE, CH_UNIX, tmp, length+2, - &value->v.sz.str, False); - - SAFE_FREE(tmp); - - if (value->v.sz.len == (size_t)-1) { + if (!convert_string_talloc(value, CH_UTF16LE, CH_UNIX, tmp, + length+2, &value->v.sz.str, + &value->v.sz.len, False)) { + SAFE_FREE(tmp); err = WERR_INVALID_PARAM; goto error; } + + SAFE_FREE(tmp); break; } case REG_MULTI_SZ: @@ -143,11 +142,13 @@ WERROR registry_push_value(TALLOC_CTX *mem_ctx, } case REG_SZ: case REG_EXPAND_SZ: { - presult->length = convert_string_talloc( - mem_ctx, CH_UNIX, CH_UTF16LE, value->v.sz.str, - MIN(value->v.sz.len, strlen(value->v.sz.str)+1), - (void *)&(presult->data), False); - if (presult->length == (size_t)-1) { + if (!convert_string_talloc(mem_ctx, CH_UNIX, CH_UTF16LE, + value->v.sz.str, + MIN(value->v.sz.len, + strlen(value->v.sz.str)+1), + (void *)&(presult->data), + &presult->length, False)) + { return WERR_NOMEM; } break; @@ -176,12 +177,13 @@ WERROR registry_push_value(TALLOC_CTX *mem_ctx, /* convert the single strings */ for (count = 0; count < value->v.multi_sz.num_strings; count++) { - string_lengths[count] = convert_string_talloc( - strings, CH_UNIX, CH_UTF16LE, - value->v.multi_sz.strings[count], + if (!convert_string_talloc(strings, CH_UNIX, + CH_UTF16LE, value->v.multi_sz.strings[count], strlen(value->v.multi_sz.strings[count])+1, - (void *)&strings[count], false); - if (string_lengths[count] == (size_t)-1) { + (void *)&strings[count], + &string_lengths[count], false)) + { + TALLOC_FREE(tmp_ctx); return WERR_NOMEM; } |