diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-01 20:01:44 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-01 20:01:44 +0000 |
commit | b2e50e8967b43dff023dda9689881ff2ddfeec92 (patch) | |
tree | 398de6be0e99c85a9d437c87ff2ff54831614aa2 /libssh/server.c | |
parent | 2c3e423480a1ae1db88dd644b062d1cc615d911b (diff) | |
download | libssh-b2e50e8967b43dff023dda9689881ff2ddfeec92.tar.gz libssh-b2e50e8967b43dff023dda9689881ff2ddfeec92.tar.xz libssh-b2e50e8967b43dff023dda9689881ff2ddfeec92.zip |
Add memory error checks for server functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@324 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/server.c')
-rw-r--r-- | libssh/server.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libssh/server.c b/libssh/server.c index 4cdf84b..ef45e6a 100644 --- a/libssh/server.c +++ b/libssh/server.c @@ -86,7 +86,10 @@ static socket_t bind_socket(SSH_BIND *ssh_bind,char *hostname, int port) { } SSH_BIND *ssh_bind_new(void){ - SSH_BIND *ptr=malloc(sizeof(SSH_BIND)); + SSH_BIND *ptr = malloc(sizeof(SSH_BIND)); + if (ptr == NULL) { + return NULL; + } memset(ptr,0,sizeof(*ptr)); ptr->bindfd=-1; return ptr; @@ -221,6 +224,9 @@ static int server_set_kex(SSH_SESSION * session) { ssh_options_set_wanted_algos(options,SSH_HOSTKEYS,"ssh-rsa"); } server->methods = malloc(10 * sizeof(char **)); + if (server->methods == NULL) { + return -1; + } for (i = 0; i < 10; i++) { if (!(wanted = options->wanted_methods[i])) wanted = supported_methods[i]; |