From 8c9d5655dad87a28005e277a767dd3f57a1a30ad Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 30 Jul 2026 21:29:08 +0000 Subject: [PATCH] Backport libssh2/libssh2#1508 on recommendation from kumama_nui --- libssh2/src/kex.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libssh2/src/kex.c b/libssh2/src/kex.c index 4ca9c34c7..72f8b704c 100644 --- a/libssh2/src/kex.c +++ b/libssh2/src/kex.c @@ -571,6 +571,11 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session, #endif /* LIBSSH2DEBUG */ + if(!session->hostkey) { + ret = _libssh2_error(session, LIBSSH2_ERROR_PROTO, + "hostkey is NULL"); + goto clean_exit; + } if(session->hostkey->init(session, session->server_hostkey, session->server_hostkey_len, &session->server_hostkey_abstract)) {