diff options
author | Damien Miller <djm@mindrot.org> | 2006-03-26 05:19:21 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2006-03-26 05:19:21 +0200 |
commit | 07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938 (patch) | |
tree | 098295eee2d7ec7b116b0db3ac4b580713dd5ab0 /ssh-agent.c | |
parent | - djm@cvs.openbsd.org 2006/03/22 21:27:15 (diff) | |
download | openssh-07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938.tar.xz openssh-07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938.zip |
- 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.c | 9 |
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; pid_t parent_pid = -1; /* pathname and directory for AUTH_SOCKET */ -char socket_name[1024]; -char socket_dir[1024]; +char socket_name[MAXPATHLEN]; +char socket_dir[MAXPATHLEN]; /* locking */ int locked = 0; @@ -803,10 +803,7 @@ new_socket(sock_type type, int fd) } old_alloc = sockets_alloc; new_alloc = sockets_alloc + 10; - if (sockets) - sockets = xrealloc(sockets, new_alloc * sizeof(sockets[0])); - else - sockets = xmalloc(new_alloc * sizeof(sockets[0])); + sockets = xrealloc(sockets, new_alloc * sizeof(sockets[0])); for (i = old_alloc; i < new_alloc; i++) sockets[i].type = AUTH_UNUSED; sockets_alloc = new_alloc; |