From: Pekka Riikonen Date: Tue, 6 May 2014 15:24:58 +0000 (+0300) Subject: silcclient: handle command timeout error correctly X-Git-Tag: silc.client.1.1.11~10 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=02745be76c1b9cee66b66a5e5bcd79b4b7f6d2a2 silcclient: handle command timeout error correctly If command which can return a list of entries such as the LIST command timeouts the cmd->status may be something other than SILC_STATUS_OK, ie. _LIST_END for example which then means ERROR_CALLBACK won't update the SILC_STATUS_ERR_TIMEOUT correctly to the cmd context. This can crash the application handling the command reply. Clear the cmd->status in case the command timedout. --- diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index 57c339aa..a3838f4e 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -246,6 +246,7 @@ SILC_FSM_STATE(silc_client_command_reply_timeout) /* Timeout, reply not received in timely fashion */ silc_list_del(conn->internal->pending_commands, cmd); + cmd->status = SILC_STATUS_OK; ERROR_CALLBACK(SILC_STATUS_ERR_TIMEDOUT); return SILC_FSM_FINISH; }