X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/2d466ffd08675d26db45e524c2fe6a8cf4628e2b..9bc81a2c80570fd9141d83f921b9bb1ef99a631b:/ssh.c diff --git a/ssh.c b/ssh.c index 45354884..a41e3bf4 100644 --- a/ssh.c +++ b/ssh.c @@ -1478,8 +1478,10 @@ static int ssh_closing(Plug plug, char *error_msg, int error_code, int calling_back) { ssh_state = SSH_STATE_CLOSED; - sk_close(s); - s = NULL; + if (s) { + sk_close(s); + s = NULL; + } if (error_msg) { /* A socket error has occurred. */ connection_fatal(error_msg); @@ -2953,8 +2955,9 @@ static int do_ssh2_transport(unsigned char *in, int inlen, int ispkt) #endif hkey = hostkey->newkey(hostkeydata, hostkeylen); - if (!hostkey->verifysig(hkey, sigdata, siglen, exchange_hash, 20)) { - bombout(("Server failed host key check")); + if (!hkey || + !hostkey->verifysig(hkey, sigdata, siglen, exchange_hash, 20)) { + bombout(("Server's host key did not match the signature supplied")); crReturn(0); }