mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
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
This commit is contained in:
@@ -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 *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));
|
memset(ptr,0,sizeof(*ptr));
|
||||||
ptr->bindfd=-1;
|
ptr->bindfd=-1;
|
||||||
return ptr;
|
return ptr;
|
||||||
@@ -221,6 +224,9 @@ static int server_set_kex(SSH_SESSION * session) {
|
|||||||
ssh_options_set_wanted_algos(options,SSH_HOSTKEYS,"ssh-rsa");
|
ssh_options_set_wanted_algos(options,SSH_HOSTKEYS,"ssh-rsa");
|
||||||
}
|
}
|
||||||
server->methods = malloc(10 * sizeof(char **));
|
server->methods = malloc(10 * sizeof(char **));
|
||||||
|
if (server->methods == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
if (!(wanted = options->wanted_methods[i]))
|
if (!(wanted = options->wanted_methods[i]))
|
||||||
wanted = supported_methods[i];
|
wanted = supported_methods[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user