From: simon Date: Mon, 29 Jan 2001 13:19:59 +0000 (+0000) Subject: Remove a segfault in bombout() macro: don't sk_close() the socket if X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/3cd52910fd75718777c4ed16d91e2965b1c5d73f Remove a segfault in bombout() macro: don't sk_close() the socket if 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 --- diff --git a/ssh.c b/ssh.c index 9354cba6..4849d91d 100644 --- 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 */