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 /packet.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 'packet.c')
-rw-r--r-- | packet.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -877,7 +877,7 @@ packet_read_seqnr(u_int32_t *seqnr_p) | |||
877 | char buf[8192]; | 877 | char buf[8192]; |
878 | DBG(debug("packet_read()")); | 878 | DBG(debug("packet_read()")); |
879 | 879 | ||
880 | setp = (fd_set *)xmalloc(howmany(connection_in+1, NFDBITS) * | 880 | setp = (fd_set *)xcalloc(howmany(connection_in+1, NFDBITS), |
881 | sizeof(fd_mask)); | 881 | sizeof(fd_mask)); |
882 | 882 | ||
883 | /* Since we are blocking, ensure that all written packets have been sent. */ | 883 | /* Since we are blocking, ensure that all written packets have been sent. */ |
@@ -1419,7 +1419,7 @@ packet_write_wait(void) | |||
1419 | { | 1419 | { |
1420 | fd_set *setp; | 1420 | fd_set *setp; |
1421 | 1421 | ||
1422 | setp = (fd_set *)xmalloc(howmany(connection_out + 1, NFDBITS) * | 1422 | setp = (fd_set *)xcalloc(howmany(connection_out + 1, NFDBITS), |
1423 | sizeof(fd_mask)); | 1423 | sizeof(fd_mask)); |
1424 | packet_write_poll(); | 1424 | packet_write_poll(); |
1425 | while (packet_have_data_to_write()) { | 1425 | while (packet_have_data_to_write()) { |