From ec961933020ca4e5485a9283b73fe2d3f8cb312f Mon Sep 17 00:00:00 2001 From: des Date: Mon, 15 Feb 1999 08:11:44 +0000 Subject: If the user provided a large enough argument to the -w option, the sum would overflow and you'd end up doing select() with a negative timeout. --- contrib/traceroute/traceroute.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'contrib/traceroute') diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c index cca0cdd..78e7c82 100644 --- a/contrib/traceroute/traceroute.c +++ b/contrib/traceroute/traceroute.c @@ -24,7 +24,7 @@ static const char copyright[] = "@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996\n\ The Regents of the University of California. All rights reserved.\n"; static const char rcsid[] = - "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.5 1996/10/08 19:16:24 sef Exp $ (LBL)"; + "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.6 1998/06/06 23:33:28 jb Exp $ (LBL)"; #endif /* @@ -732,6 +732,8 @@ wait_for_reply(register int sock, register struct sockaddr_in *fromp, wait.tv_sec = tp->tv_sec + waittime; wait.tv_usec = tp->tv_usec; (void)gettimeofday(&now, &tz); + if (wait.tv_sec < now.tv_sec + 1) + wait.tv_sec = now.tv_sec + 1; tvsub(&wait, &now); if (select(sock + 1, &fds, (fd_set *)0, (fd_set *)0, &wait) > 0) -- cgit v1.1