aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-09-03 17:20:06 +0200
committerAndreas Schneider <mail@cynapses.org>2009-09-03 17:20:06 +0200
commit0792c015d63bc085e18b53248e05390e899a4290 (patch)
tree7cb2ec90762e88d569eaf173477d277bc8c2c941 /libssh
parent8344598910e96899c16011559f2e9f8f26c4d24d (diff)
downloadlibssh-0792c015d63bc085e18b53248e05390e899a4290.tar.gz
libssh-0792c015d63bc085e18b53248e05390e899a4290.tar.xz
libssh-0792c015d63bc085e18b53248e05390e899a4290.zip
Add missing NULL pointer checks to crypt_set_algorithms_server.
Thanks to Orange Labs for the report.
Diffstat (limited to 'libssh')
-rw-r--r--libssh/wrapper.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libssh/wrapper.c b/libssh/wrapper.c
index a052c140..1eac8e74 100644
--- a/libssh/wrapper.c
+++ b/libssh/wrapper.c
@@ -906,7 +906,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);
@@ -982,12 +982,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;