diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-08-28 23:35:59 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-08-28 23:35:59 +0200 |
commit | c1efcd28f596da1f09582298c99e557c3f1083c8 (patch) | |
tree | 05e77eea5d3eedaddb94472da7ab7b3ac305676e | |
parent | 1fa94095543c2b20fade817a5be412edf94dec06 (diff) | |
download | libssh-c1efcd28f596da1f09582298c99e557c3f1083c8.tar.gz libssh-c1efcd28f596da1f09582298c99e557c3f1083c8.tar.xz libssh-c1efcd28f596da1f09582298c99e557c3f1083c8.zip |
Fixes bug #99
returns error when no cryptographic context is available
-rw-r--r-- | libssh/dh.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libssh/dh.c b/libssh/dh.c index 08988c68..8ad80a0e 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) { |