Remove a segfault in bombout() macro: don't sk_close() the socket if
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 29 Jan 2001 13:19:59 +0000 (13:19 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 29 Jan 2001 13:19:59 +0000 (13:19 +0000)
it's already NULL. The `Incorrect MAC' problem was causing
ssh2_rdpkt to bombout(), setting s to NULL, and then a secondary
bombout() was happening at the next level up, causing a segfault.

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

ssh.c

diff --git a/ssh.c b/ssh.c
index 9354cba..4849d91 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -19,8 +19,9 @@
                       if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) \
                       fprintf(stderr, "%s\n", s); }
 
-#define bombout(msg) ( ssh_state = SSH_STATE_CLOSED, sk_close(s), \
-                       s = NULL, connection_fatal msg )
+#define bombout(msg) ( ssh_state = SSH_STATE_CLOSED, \
+                          (s ? sk_close(s), s = NULL : (void)0), \
+                          connection_fatal msg )
 
 #define SSH1_MSG_DISCONNECT                       1    /* 0x1 */
 #define SSH1_SMSG_PUBLIC_KEY                      2    /* 0x2 */