diff options
author | Damien Miller <djm@mindrot.org> | 2006-03-26 14:19:21 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2006-03-26 14:19:21 +1100 |
commit | 07d86bec5eeaf19fe33dca99c8ebcbe9a77c3938 (patch) | |
tree | 098295eee2d7ec7b116b0db3ac4b580713dd5ab0 /monitor.c | |
parent | 7cd4579eb3c5afd22ae24436fd2611cd3aa0150a (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 'monitor.c')
-rw-r--r-- | monitor.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1625,8 +1625,7 @@ mm_get_kex(Buffer *m) | |||
1625 | void *blob; | 1625 | void *blob; |
1626 | u_int bloblen; | 1626 | u_int bloblen; |
1627 | 1627 | ||
1628 | kex = xmalloc(sizeof(*kex)); | 1628 | kex = xcalloc(1, sizeof(*kex)); |
1629 | memset(kex, 0, sizeof(*kex)); | ||
1630 | kex->session_id = buffer_get_string(m, &kex->session_id_len); | 1629 | kex->session_id = buffer_get_string(m, &kex->session_id_len); |
1631 | if ((session_id2 == NULL) || | 1630 | if ((session_id2 == NULL) || |
1632 | (kex->session_id_len != session_id2_len) || | 1631 | (kex->session_id_len != session_id2_len) || |
@@ -1796,9 +1795,8 @@ monitor_init(void) | |||
1796 | struct monitor *mon; | 1795 | struct monitor *mon; |
1797 | int pair[2]; | 1796 | int pair[2]; |
1798 | 1797 | ||
1799 | mon = xmalloc(sizeof(*mon)); | 1798 | mon = xcalloc(1, sizeof(*mon)); |
1800 | 1799 | ||
1801 | mon->m_pid = 0; | ||
1802 | monitor_socketpair(pair); | 1800 | monitor_socketpair(pair); |
1803 | 1801 | ||
1804 | mon->m_recvfd = pair[0]; | 1802 | mon->m_recvfd = pair[0]; |