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:38:53 +0200 |
commit | c087e8704d3259b809043bc198d1c90f333a2548 (patch) | |
tree | 1baa2a3ae305b010b7fcaa803d823732df370a3d | |
parent | e5801287da1b83f9dbc68bae4e8a54394f23c8ec (diff) | |
download | libssh-c087e8704d3259b809043bc198d1c90f333a2548.tar.gz libssh-c087e8704d3259b809043bc198d1c90f333a2548.tar.xz libssh-c087e8704d3259b809043bc198d1c90f333a2548.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 0142c8d5..09d09892 100644 --- a/libssh/dh.c +++ b/libssh/dh.c @@ -831,8 +831,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) { |