summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2002-06-23 21:54:18 +0000
committerrobert <robert@FreeBSD.org>2002-06-23 21:54:18 +0000
commit594ec288d5a81032257d4d24a27997d36d2d1470 (patch)
treefb30d10bc5852b56757be26de2c7e7498cad5a0f /contrib
parenta8ea4bbfd10ec9a3936ace82d4fa7368bad38a7b (diff)
downloadFreeBSD-src-594ec288d5a81032257d4d24a27997d36d2d1470.zip
FreeBSD-src-594ec288d5a81032257d4d24a27997d36d2d1470.tar.gz
Allocate and clear the correct number of bytes for a
struct fd_set that should be able to hold sock + 1 bits. Before, it was apparently assumed that an fd_mask has the same size as type char. PR: bin/39617 Reported by: Peter N Lewis <peter@stairways.com.au>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/traceroute/traceroute.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c
index 8cfbfe3..487b7db 100644
--- a/contrib/traceroute/traceroute.c
+++ b/contrib/traceroute/traceroute.c
@@ -906,9 +906,9 @@ wait_for_reply(register int sock, register struct sockaddr_in *fromp,
int fromlen = sizeof(*fromp);
nfds = howmany(sock + 1, NFDBITS);
- if ((fdsp = malloc(nfds)) == NULL)
+ if ((fdsp = malloc(nfds * sizeof(fd_mask))) == NULL)
err(1, "malloc");
- memset(fdsp, 0, nfds);
+ memset(fdsp, 0, nfds * sizeof(fd_mask));
FD_SET(sock, fdsp);
wait.tv_sec = tp->tv_sec + waittime;
OpenPOWER on IntegriCloud