]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
Add a missing null pointer check in s_write.
authorSimon Tatham <anakin@pobox.com>
Sun, 17 Nov 2013 14:04:56 +0000 (14:04 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 17 Nov 2013 14:04:56 +0000 (14:04 +0000)
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.

git-svn-id: http://svn.tartarus.org/sgt/putty@10076 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index fa9bc745d13ee4f785b942248d6cec5882427d74..e6b2d6be9cf6158d1a28777aa6fbf5879bef9c54 100644 (file)
--- 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);
 }