diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-01 19:54:41 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-01 19:54:41 +0000 |
commit | 8bcd65193c51be8ac94b9b7691253aeecb446265 (patch) | |
tree | 77b339a2e60edfaaf6eb1d46fdde8dd583d0ded8 /libssh/server.c | |
parent | 54ce86e3b13750d5f49cc9c5e3cacaae74f86f61 (diff) | |
download | libssh-8bcd65193c51be8ac94b9b7691253aeecb446265.tar.gz libssh-8bcd65193c51be8ac94b9b7691253aeecb446265.tar.xz libssh-8bcd65193c51be8ac94b9b7691253aeecb446265.zip |
Added memory error checks for option functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@322 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/server.c')
-rw-r--r-- | libssh/server.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libssh/server.c b/libssh/server.c index bb80ead..4cdf84b 100644 --- a/libssh/server.c +++ b/libssh/server.c @@ -170,10 +170,20 @@ SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind){ session=ssh_new(); session->server=1; session->version=2; + session->options = ssh_options_copy(ssh_bind->options); + if (session->options == NULL) { + ssh_set_error(ssh_bind, SSH_FATAL, "No space left"); + if (dsa) + private_key_free(dsa); + if (rsa) + private_key_free(rsa); + ssh_cleanup(session); + return NULL; + } + ssh_socket_free(session->socket); session->socket=ssh_socket_new(session); ssh_socket_set_fd(session->socket,fd); - session->options=ssh_options_copy(ssh_bind->options); session->dsa_key=dsa; session->rsa_key=rsa; return session; |