diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-10-20 14:47:11 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-10-20 14:47:11 +0200 |
commit | 98221f4e3640b2522851e49c7f81f5e500ed4a25 (patch) | |
tree | f1dc9608ec61cfb2d73a64580589b6746a04c198 /src/dh.c | |
parent | 8e2699e16139c8efdc54a06471de29966ccc233a (diff) | |
download | libssh-98221f4e3640b2522851e49c7f81f5e500ed4a25.tar.gz libssh-98221f4e3640b2522851e49c7f81f5e500ed4a25.tar.xz libssh-98221f4e3640b2522851e49c7f81f5e500ed4a25.zip |
Fixed a bunch of smallish bugs
http://linuxtesting.org/upstream-tracker/test_results/libssh/current/test_results.html
for a whole list
Diffstat (limited to 'src/dh.c')
-rw-r--r-- | src/dh.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -832,23 +832,24 @@ int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash) { unsigned char *h; if (session == NULL || hash == NULL) { - return -1; + return SSH_ERROR; } *hash = NULL; if (session->current_crypto == NULL || session->current_crypto->server_pubkey == NULL){ ssh_set_error(session,SSH_FATAL,"No current cryptographic context"); + return SSH_ERROR; } h = malloc(sizeof(unsigned char *) * MD5_DIGEST_LEN); if (h == NULL) { - return -1; + return SSH_ERROR; } ctx = md5_init(); if (ctx == NULL) { SAFE_FREE(h); - return -1; + return SSH_ERROR; } pubkey = session->current_crypto->server_pubkey; @@ -877,6 +878,10 @@ void ssh_clean_pubkey_hash(unsigned char **hash) { } ssh_string ssh_get_pubkey(ssh_session session){ + if(session==NULL || session->current_crypto ==NULL || + session->current_crypto->server_pubkey==NULL) + return NULL; + else return ssh_string_copy(session->current_crypto->server_pubkey); } |