summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-09-03 17:20:06 +0200
committerAndreas Schneider <mail@cynapses.org>2009-09-08 11:36:28 +0200
commit1093fb43ca7cb139efbe580bf6d0e9bbd68b1101 (patch)
treeba422fe99e7bac7a8985a6a29e0fea58e61d056f
parentadd2aa5f45af2d381a1638cdd0d5fcacc1fdd8f9 (diff)
downloadlibssh-1093fb43ca7cb139efbe580bf6d0e9bbd68b1101.tar.gz
libssh-1093fb43ca7cb139efbe580bf6d0e9bbd68b1101.tar.xz
libssh-1093fb43ca7cb139efbe580bf6d0e9bbd68b1101.zip
Add missing NULL pointer checks to crypt_set_algorithms_server.
Thanks to Orange Labs for the report.
-rw-r--r--libssh/wrapper.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libssh/wrapper.c b/libssh/wrapper.c
index f2011d88..a8ec3859 100644
--- a/libssh/wrapper.c
+++ b/libssh/wrapper.c
@@ -901,7 +901,7 @@ int crypt_set_algorithms_server(SSH_SESSION *session){
/* out */
server = session->server_kex.methods[SSH_CRYPT_S_C];
client = session->client_kex.methods[SSH_CRYPT_S_C];
- match = ssh_find_matching(client,server);
+ match = ssh_find_matching(client, server);
if(!match){
ssh_set_error(session,SSH_FATAL,"Crypt_set_algorithms_server : no matching algorithm function found for %s",server);
@@ -977,12 +977,13 @@ int crypt_set_algorithms_server(SSH_SESSION *session){
server=session->server_kex.methods[SSH_HOSTKEYS];
client=session->client_kex.methods[SSH_HOSTKEYS];
match=ssh_find_matching(client,server);
- if(!strcmp(match,"ssh-dss"))
+ if(match && !strcmp(match,"ssh-dss"))
session->hostkeys=TYPE_DSS;
- else if(!strcmp(match,"ssh-rsa"))
+ else if(match && !strcmp(match,"ssh-rsa"))
session->hostkeys=TYPE_RSA;
else {
- ssh_set_error(session,SSH_FATAL,"cannot know what %s is into %s",match,server);
+ ssh_set_error(session, SSH_FATAL, "Cannot know what %s is into %s",
+ match ? match : NULL, server);
free(match);
leave_function();
return SSH_ERROR;