summaryrefslogtreecommitdiffstats
path: root/libssh/client.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-01 21:24:16 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-01 21:24:16 +0000
commit891539af6cbdbdfabb8d37fb491f7f8cadf9823c (patch)
tree1699cb47cd68dc35a972f8b5e1d834946c48d944 /libssh/client.c
parent1b627b386763e22a7b8f7a7c8de9610c1da56cd2 (diff)
downloadlibssh-891539af6cbdbdfabb8d37fb491f7f8cadf9823c.tar.gz
libssh-891539af6cbdbdfabb8d37fb491f7f8cadf9823c.tar.xz
libssh-891539af6cbdbdfabb8d37fb491f7f8cadf9823c.zip
Add memory error checks for crypto wrapper functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@330 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/client.c')
-rw-r--r--libssh/client.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libssh/client.c b/libssh/client.c
index b79c605..76645e5 100644
--- a/libssh/client.c
+++ b/libssh/client.c
@@ -213,7 +213,13 @@ static int dh_handshake(SSH_SESSION *session){
crypto_free(session->current_crypto);
/* XXX later, include a function to change keys */
session->current_crypto=session->next_crypto;
- session->next_crypto=crypto_new();
+
+ session->next_crypto = crypto_new();
+ if (session->next_crypto == NULL) {
+ leave_function();
+ return SSH_ERROR;
+ }
+
session->dh_handshake_state=DH_STATE_FINISHED;
leave_function();
return SSH_OK;