Fix NULL pointer dereference in libgpo when listing Local Policy which has no securit...
[ira/wip.git] / libgpo / gpo_ini.c
index af2b88c0b8a311f702d6ed7403641b3ea9ecc65b..7df56a81b0079dce1951f1605299f862552aedc2 100644 (file)
@@ -42,6 +42,7 @@ static bool store_keyval_pair(const char *key, const char *value, void *ctx_ptr)
 {
        struct gp_inifile_context *ctx = (struct gp_inifile_context *) ctx_ptr;
        ctx->data = talloc_realloc(ctx, ctx->data, struct keyval_pair *, ctx->keyval_count+1);
+       ctx->data[ctx->keyval_count] = talloc_zero(ctx, struct keyval_pair);
        ctx->data[ctx->keyval_count]->key = talloc_asprintf(ctx, "%s:%s", ctx->current_section, key);
        ctx->data[ctx->keyval_count]->val = talloc_strdup(ctx, value);
        ctx->keyval_count++;
@@ -87,7 +88,7 @@ static NTSTATUS convert_file_from_ucs2(TALLOC_CTX *mem_ctx,
        }
 
        if (!convert_string_talloc(mem_ctx, CH_UTF16LE, CH_UNIX, data_in, n,
-                                  (void **)&data_out, &converted_size, false))
+                                  (void *)&data_out, &converted_size, false))
        {
                status = NT_STATUS_INVALID_BUFFER_SIZE;
                goto out;