diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-07 18:46:29 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-07 18:46:29 +0000 |
commit | 8c05aab03d687915ab87b47922e95c8f608b0250 (patch) | |
tree | b1b8837f7a990165d75e597e46b605c45ac3dedc /libssh/kex.c | |
parent | 323ee63a1d267548b60492a4f94ade2e29d6fce7 (diff) | |
download | libssh-8c05aab03d687915ab87b47922e95c8f608b0250.tar.gz libssh-8c05aab03d687915ab87b47922e95c8f608b0250.tar.xz libssh-8c05aab03d687915ab87b47922e95c8f608b0250.zip |
Add return value and error checking for hash buffer cookie functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@419 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/kex.c')
-rw-r--r-- | libssh/kex.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libssh/kex.c b/libssh/kex.c index 4ad622e0..803141e6 100644 --- a/libssh/kex.c +++ b/libssh/kex.c @@ -243,7 +243,11 @@ int ssh_get_kex(SSH_SESSION *session,int server_kex ){ leave_function(); return -1; } - hashbufin_add_cookie(session,session->server_kex.cookie); + if (hashbufin_add_cookie(session, session->server_kex.cookie) < 0) { + ssh_set_error(session, SSH_FATAL, "get_kex(): adding cookie failed"); + leave_function(); + return -1; + } memset(strings,0,sizeof(char *)*10); for(i=0;i<10;++i){ str=buffer_get_ssh_string(session->in_buffer); @@ -337,7 +341,8 @@ int set_kex(SSH_SESSION *session){ return 0; } -/* this function only sends the predefined set of kex methods */ +/* this function only sends the predefined set of kex methods */ +/* TODO add return value! */ void ssh_send_kex(SSH_SESSION *session, int server_kex){ STRING *str; int i=0; @@ -345,7 +350,9 @@ void ssh_send_kex(SSH_SESSION *session, int server_kex){ enter_function(); buffer_add_u8(session->out_buffer,SSH2_MSG_KEXINIT); buffer_add_data(session->out_buffer,kex->cookie,16); - hashbufout_add_cookie(session); + if (hashbufout_add_cookie(session) < 0) { + return; + } ssh_list_kex(session, kex); for(i=0;i<10;i++){ str=string_from_char(kex->methods[i]); |