Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.sbin/mtrace6 Pullup 1.4 [itojun]:
details: https://anonhg.NetBSD.org/src/rev/85a380b14c2f
branches: netbsd-1-5
changeset: 489862:85a380b14c2f
user: tv <tv%NetBSD.org@localhost>
date: Wed Oct 18 02:03:49 2000 +0000
description:
Pullup 1.4 [itojun]:
avoid fd_set overflow
diffstat:
usr.sbin/mtrace6/mtrace6.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r 05f7911e1363 -r 85a380b14c2f usr.sbin/mtrace6/mtrace6.c
--- a/usr.sbin/mtrace6/mtrace6.c Wed Oct 18 02:03:03 2000 +0000
+++ b/usr.sbin/mtrace6/mtrace6.c Wed Oct 18 02:03:49 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mtrace6.c,v 1.3 2000/02/26 11:44:28 itojun Exp $ */
+/* $NetBSD: mtrace6.c,v 1.3.4.1 2000/10/18 02:03:49 tv Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
@@ -34,6 +34,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/select.h>
+#include <sys/queue.h>
#include <net/if.h>
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
@@ -216,7 +217,8 @@
{
int nsoc, fromlen, rcvcc;
struct timeval tv, tv_wait;
- struct fd_set fds;
+ struct fd_set *fdsp;
+ size_t nfdsp;
struct sockaddr_storage from_ss;
struct sockaddr *from_sock = (struct sockaddr *)&from_ss;
@@ -234,11 +236,16 @@
tv_wait.tv_sec = waittime;
tv_wait.tv_usec = 0;
- FD_ZERO(&fds);
- FD_SET(mldsoc, &fds);
+ nfdsp = howmany(mldsoc + 1, NFDBITS);
+ fdsp = malloc(nfdsp);
+ if (!fdsp)
+ err(1, "malloc");
+ memset(fdsp, 0, nfdsp);
+ FD_SET(mldsoc, fdsp);
- if ((nsoc = select(mldsoc + 1, &fds, NULL, NULL, &tv_wait)) < 0)
+ if ((nsoc = select(mldsoc + 1, fdsp, NULL, NULL, &tv_wait)) < 0)
err(1, "select");
+ free(fdsp);
if (nsoc == 0) {
printf("Timeout\n");
Home |
Main Index |
Thread Index |
Old Index