From 02745be76c1b9cee66b66a5e5bcd79b4b7f6d2a2 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 6 May 2014 18:24:58 +0300 Subject: [PATCH] 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. --- lib/silcclient/command_reply.c | 1 + 1 file changed, 1 insertion(+) 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; } -- 2.24.0