diff options
author | ru <ru@FreeBSD.org> | 1999-06-18 14:26:07 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 1999-06-18 14:26:07 +0000 |
commit | 97705ed6e4ac0c801217439c360072830d00cf8b (patch) | |
tree | c7a9ea96be6a865db6c443b8247118a343989edd | |
parent | db9a1d7a4e9f450a3216fa0666a034c28d3cc40a (diff) | |
download | FreeBSD-src-97705ed6e4ac0c801217439c360072830d00cf8b.zip FreeBSD-src-97705ed6e4ac0c801217439c360072830d00cf8b.tar.gz |
Fix a coredump with negative (due to overflow) offset values.
-rw-r--r-- | sbin/shutdown/shutdown.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/shutdown/shutdown.c b/sbin/shutdown/shutdown.c index 680925f..03a1866 100644 --- a/sbin/shutdown/shutdown.c +++ b/sbin/shutdown/shutdown.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)shutdown.c 8.4 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: shutdown.c,v 1.15 1998/12/11 11:04:19 bde Exp $"; + "$Id: shutdown.c,v 1.16 1998/12/11 11:21:47 bde Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -232,7 +232,7 @@ loop() if (tp->timeleft < offset) (void)sleep((u_int)(offset - tp->timeleft)); else { - while (offset < tp->timeleft) + while (tp->timeleft && offset < tp->timeleft) ++tp; /* * Warn now, if going to sleep more than a fifth of @@ -392,7 +392,8 @@ getoffset(timearg) if (*timearg == '+') { /* +minutes */ if (!isdigit(*++timearg)) badtime(); - offset = atoi(timearg) * 60; + if ((offset = atoi(timearg) * 60) < 0) + badtime(); shuttime = now + offset; return; } |