Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/last Avoid SIGSEGV on out-of-range time_t.
details: https://anonhg.NetBSD.org/src/rev/80cf3ae693e1
branches: trunk
changeset: 755416:80cf3ae693e1
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Jun 05 03:24:01 2010 +0000
description:
Avoid SIGSEGV on out-of-range time_t.
diffstat:
usr.bin/last/last.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r 200c5e804173 -r 80cf3ae693e1 usr.bin/last/last.c
--- a/usr.bin/last/last.c Sat Jun 05 03:02:37 2010 +0000
+++ b/usr.bin/last/last.c Sat Jun 05 03:24:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: last.c,v 1.33 2009/04/12 13:07:21 lukem Exp $ */
+/* $NetBSD: last.c,v 1.34 2010/06/05 03:24:01 dholland Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
#endif
-__RCSID("$NetBSD: last.c,v 1.33 2009/04/12 13:07:21 lukem Exp $");
+__RCSID("$NetBSD: last.c,v 1.34 2010/06/05 03:24:01 dholland Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -362,6 +362,10 @@
static char tbuf[TBUFLEN];
tm = (flags & GMT) ? gmtime(&t) : localtime(&t);
+ if (tm == NULL) {
+ strcpy(tbuf, "????");
+ return tbuf;
+ }
strftime(tbuf, sizeof(tbuf),
(flags & TIMEONLY)
? (flags & FULLTIME ? LTFMTS : TFMTS)
Home |
Main Index |
Thread Index |
Old Index