From 136127fe86ff65414e1053c2f23b2126fb91b204 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 30 Aug 2008 14:14:45 +0300 Subject: [PATCH] Fixed command calling crash If command finishes synchronously the command context is not valid anymore and cannot be accessed. Reported by Sami Farin. --- lib/silcclient/command.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/silcclient/command.c b/lib/silcclient/command.c index 85e33fe3..0e72368d 100644 --- a/lib/silcclient/command.c +++ b/lib/silcclient/command.c @@ -411,6 +411,7 @@ SilcUInt16 silc_client_command_call(SilcClient client, SilcUInt32 argc = 0; unsigned char **argv = NULL; SilcUInt32 *argv_lens = NULL, *argv_types = NULL; + SilcUInt16 cmd_ident; SilcClientCommand command; SilcClientCommandContext cmd; char *arg; @@ -480,7 +481,7 @@ SilcUInt16 silc_client_command_call(SilcClient client, cmd->argv = argv; cmd->argv_lens = argv_lens; cmd->argv_types = argv_types; - cmd->cmd_ident = silc_client_cmd_ident(conn); + cmd_ident = cmd->cmd_ident = silc_client_cmd_ident(conn); cmd->called = TRUE; cmd->verbose = TRUE; silc_list_init(cmd->reply_callbacks, @@ -492,7 +493,7 @@ SilcUInt16 silc_client_command_call(SilcClient client, silc_client_command_destructor, NULL, FALSE); silc_fsm_start_sync(&cmd->thread, command->command); - return cmd->cmd_ident; + return cmd_ident; } /* Generic function to send any command. The arguments must be sent already -- 2.24.0