summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-03-26 14:19:21 +1100
committerDamien Miller <djm@mindrot.org>2006-03-26 14:19:21 +1100
commit07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938 (patch)
tree098295eee2d7ec7b116b0db3ac4b580713dd5ab0 /ssh-agent.c
parent7cd4579eb3c5afd22ae24436fd2611cd3aa0150a (diff)
- djm@cvs.openbsd.org 2006/03/25 00:05:41
[auth-bsdauth.c auth-skey.c auth.c auth2-chall.c channels.c] [clientloop.c deattack.c gss-genr.c kex.c key.c misc.c moduli.c] [monitor.c monitor_wrap.c packet.c scard.c sftp-server.c ssh-agent.c] [ssh-keyscan.c ssh.c sshconnect.c sshconnect2.c sshd.c uuencode.c] [xmalloc.c xmalloc.h] introduce xcalloc() and xasprintf() failure-checked allocations functions and use them throughout openssh xcalloc is particularly important because malloc(nmemb * size) is a dangerous idiom (subject to integer overflow) and it is time for it to die feedback and ok deraadt@
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index 7feb898dd..67bde5560 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -109,8 +109,8 @@ int max_fd = 0;
109pid_t parent_pid = -1; 109pid_t parent_pid = -1;
110 110
111/* pathname and directory for AUTH_SOCKET */ 111/* pathname and directory for AUTH_SOCKET */
112char socket_name[1024]; 112char socket_name[MAXPATHLEN];
113char socket_dir[1024]; 113char socket_dir[MAXPATHLEN];
114 114
115/* locking */ 115/* locking */
116int locked = 0; 116int locked = 0;
@@ -803,10 +803,7 @@ new_socket(sock_type type, int fd)
803 } 803 }
804 old_alloc = sockets_alloc; 804 old_alloc = sockets_alloc;
805 new_alloc = sockets_alloc + 10; 805 new_alloc = sockets_alloc + 10;
806 if (sockets) 806 sockets = xrealloc(sockets, new_alloc * sizeof(sockets[0]));
807 sockets = xrealloc(sockets, new_alloc * sizeof(sockets[0]));
808 else
809 sockets = xmalloc(new_alloc * sizeof(sockets[0]));
810 for (i = old_alloc; i < new_alloc; i++) 807 for (i = old_alloc; i < new_alloc; i++)
811 sockets[i].type = AUTH_UNUSED; 808 sockets[i].type = AUTH_UNUSED;
812 sockets_alloc = new_alloc; 809 sockets_alloc = new_alloc;