From f0a90551b279c2dc7ab9d4c0e4b16b3e724548e2 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 8 Feb 2011 15:33:51 +0100 Subject: s3-rpc_server: Fixed possible segfaults in svcctl server. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/rpc_server/srv_svcctl_reg.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3') diff --git a/source3/rpc_server/srv_svcctl_reg.c b/source3/rpc_server/srv_svcctl_reg.c index 7de47d8927..ca6a68a2fd 100644 --- a/source3/rpc_server/srv_svcctl_reg.c +++ b/source3/rpc_server/srv_svcctl_reg.c @@ -483,6 +483,7 @@ static bool svcctl_add_service(TALLOC_CTX *mem_ctx, if (is_valid_policy_hnd(&key_hnd)) { dcerpc_winreg_CloseKey(h, mem_ctx, &key_hnd, &result); } + ZERO_STRUCT(key_hnd); ZERO_STRUCT(wkey); wkey.name = talloc_asprintf(mem_ctx, "%s\\%s\\Security", key, name); @@ -564,7 +565,13 @@ bool svcctl_init_winreg(struct messaging_context *msg_ctx) DEBUG(3, ("Initialise the svcctl registry keys if needed.\n")); + ZERO_STRUCT(hive_hnd); + ZERO_STRUCT(key_hnd); + key = talloc_strdup(tmp_ctx, TOP_LEVEL_SERVICES_KEY); + if (key == NULL) { + goto done; + } status = dcerpc_winreg_int_hklm_openkey(tmp_ctx, get_server_info_system(), @@ -653,6 +660,7 @@ bool svcctl_init_winreg(struct messaging_context *msg_ctx) if (is_valid_policy_hnd(&key_hnd)) { dcerpc_winreg_CloseKey(h, tmp_ctx, &key_hnd, &result); } + ZERO_STRUCT(key_hnd); if (!ok) { goto done; -- cgit