diff options
author | Bernhard R. Link <brlink@debian.org> | 2009-10-04 14:23:50 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-10-05 00:04:38 +0200 |
commit | bf376b6d4fd4dad7ced0e49bedc76cc2a0d797f1 (patch) | |
tree | ef019e0caa79de5114ecd339a9c3db2376af1ad4 /libssh | |
parent | ff52e3630f8cbe37ea93962d4bd104c581b33655 (diff) | |
download | libssh-bf376b6d4fd4dad7ced0e49bedc76cc2a0d797f1.tar.gz libssh-bf376b6d4fd4dad7ced0e49bedc76cc2a0d797f1.tar.xz libssh-bf376b6d4fd4dad7ced0e49bedc76cc2a0d797f1.zip |
do not segfault in ssh_bind_accept if bindaddr is NULL
Signed-off-by: Andreas Schneider <mail@cynapses.org>
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/server.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libssh/server.c b/libssh/server.c index 2a8ba334..96acb5b0 100644 --- a/libssh/server.c +++ b/libssh/server.c @@ -251,12 +251,16 @@ ssh_session ssh_bind_accept(SSH_BIND *sshbind) { } } - session->bindaddr = strdup(sshbind->bindaddr); - if (session->bindaddr == NULL) { - privatekey_free(dsa); - privatekey_free(rsa); - ssh_cleanup(session); - return NULL; + if (sshbind->bindaddr == NULL) + session->bindaddr = NULL; + else { + session->bindaddr = strdup(sshbind->bindaddr); + if (session->bindaddr == NULL) { + privatekey_free(dsa); + privatekey_free(rsa); + ssh_cleanup(session); + return NULL; + } } ssh_socket_free(session->socket); |