From 58fd58d64ceaec2efbac5cd35164074d1ca883ae Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 10 Mar 2019 17:21:30 +0000 Subject: [PATCH] Fix crash if the SSH server disconnects. When ssh_remote_error returns, the ssh2_transport_state has been freed, so we shouldn't try to reach into it to pop its in_pq. --- ssh2transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh2transport.c b/ssh2transport.c index 204c2440..bcb1fee6 100644 --- a/ssh2transport.c +++ b/ssh2transport.c @@ -347,7 +347,7 @@ bool ssh2_common_filter_queue(PacketProtocolLayer *ppl) ((reason > 0 && reason < lenof(ssh2_disconnect_reasons)) ? ssh2_disconnect_reasons[reason] : "unknown"), PTRLEN_PRINTF(msg)); - pq_pop(ppl->in_pq); + /* don't try to pop the queue, because we've been freed! */ return true; /* indicate that we've been freed */ case SSH2_MSG_DEBUG: