From f7259d1028b10c11812d455d01ed569a08004268 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 4 Aug 2001 12:37:43 +0000 Subject: [PATCH] Fix segfault if the server maliciously sends the wrong type of key after a different type has been agreed. git-svn-id: svn://svn.tartarus.org/sgt/putty@1165 cda61777-01e9-0310-a592-d414129be87e --- ssh.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ssh.c b/ssh.c index e2c2d737..a41e3bf4 100644 --- a/ssh.c +++ b/ssh.c @@ -2955,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); } -- 2.11.0