From c1efcd28f596da1f09582298c99e557c3f1083c8 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Sat, 28 Aug 2010 23:35:59 +0200 Subject: Fixes bug #99 returns error when no cryptographic context is available --- libssh/dh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libssh') diff --git a/libssh/dh.c b/libssh/dh.c index 08988c6..8ad80a0 100644 --- a/libssh/dh.c +++ b/libssh/dh.c @@ -835,8 +835,11 @@ int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash) { if (session == NULL || hash == NULL) { return -1; } - *hash = NULL; + if (session->current_crypto == NULL || + session->current_crypto->server_pubkey == NULL){ + ssh_set_error(session,SSH_FATAL,"No current cryptographic context"); + } h = malloc(sizeof(unsigned char *) * MD5_DIGEST_LEN); if (h == NULL) { -- cgit v1.2.3