From b71b443c7c302b05342efef93c616c8b108ba7d2 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 17 Nov 2013 14:04:56 +0000 Subject: [PATCH] Add a missing null pointer check in s_write. I don't know that this can ever be triggered in the current state of the code, but when I start mucking around with SSH session closing in the near future, it may be handy to have it. [originally from svn r10076] --- ssh.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ssh.c b/ssh.c index fa9bc745..e6b2d6be 100644 --- a/ssh.c +++ b/ssh.c @@ -1762,6 +1762,8 @@ static int s_write(Ssh ssh, void *data, int len) if (ssh->logctx) log_packet(ssh->logctx, PKT_OUTGOING, -1, NULL, data, len, 0, NULL, NULL); + if (!ssh->s) + return 0; return sk_write(ssh->s, (char *)data, len); }