Fixed crash when receiving unexpected response during host key test.

This commit is contained in:
Joe Testa
2020-11-05 20:29:39 -05:00
parent 52d1e8f27b
commit 338ffc5adb
2 changed files with 7 additions and 3 deletions

View File

@ -135,9 +135,12 @@ class HostKeyTest:
# Do the initial DH exchange. The server responds back
# with the host key and its length. Bingo. We also get back the host key fingerprint.
kex_group.send_init(s)
host_key = kex_group.recv_reply(s, variable_key_len)
if host_key is not None:
server_kex.set_host_key(host_key_type, host_key)
try:
host_key = kex_group.recv_reply(s, variable_key_len)
if host_key is not None:
server_kex.set_host_key(host_key_type, host_key)
except Exception:
pass
hostkey_modulus_size = kex_group.get_hostkey_size()
ca_modulus_size = kex_group.get_ca_size()