Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/finger Avoid segmentation fault if "finger @somehost...
details: https://anonhg.NetBSD.org/src/rev/8584523398df
branches: trunk
changeset: 534879:8584523398df
user: tron <tron%NetBSD.org@localhost>
date: Mon Aug 05 08:04:03 2002 +0000
description:
Avoid segmentation fault if "finger @somehost" is used.
diffstat:
usr.bin/finger/Makefile | 5 ++++-
usr.bin/finger/finger.c | 9 +++++----
usr.bin/finger/lprint.c | 7 +++++--
usr.bin/finger/sprint.c | 7 +++++--
4 files changed, 19 insertions(+), 9 deletions(-)
diffs (114 lines):
diff -r 95e219d61576 -r 8584523398df usr.bin/finger/Makefile
--- a/usr.bin/finger/Makefile Mon Aug 05 07:44:06 2002 +0000
+++ b/usr.bin/finger/Makefile Mon Aug 05 08:04:03 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2002/08/02 00:10:40 christos Exp $
+# $NetBSD: Makefile,v 1.7 2002/08/05 08:04:03 tron Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
PROG= finger
@@ -7,4 +7,7 @@
.PATH.c: ${.CURDIR}/../../usr.bin/who
CPPFLAGS+=-I${.CURDIR}/../../usr.bin/who -DSUPPORT_UTMPX -DSUPPORT_UTMP -DINET6
+CFLAGS+= -g
+LDFLAGS+= -g
+
.include <bsd.prog.mk>
diff -r 95e219d61576 -r 8584523398df usr.bin/finger/finger.c
--- a/usr.bin/finger/finger.c Mon Aug 05 07:44:06 2002 +0000
+++ b/usr.bin/finger/finger.c Mon Aug 05 08:04:03 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: finger.c,v 1.16 2002/08/02 00:10:40 christos Exp $ */
+/* $NetBSD: finger.c,v 1.17 2002/08/05 08:04:03 tron Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -56,7 +56,7 @@
#if 0
static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: finger.c,v 1.16 2002/08/02 00:10:40 christos Exp $");
+__RCSID("$NetBSD: finger.c,v 1.17 2002/08/05 08:04:03 tron Exp $");
#endif
#endif /* not lint */
@@ -146,7 +146,7 @@
(void)time(&now);
setpassent(1);
entries = getutentries(NULL, &ehead);
- if (!*argv) {
+ if (argc == 0) {
/*
* Assign explicit "small" format if no names given and -l
* not selected. Force the -s BEFORE we get names so proper
@@ -277,7 +277,7 @@
continue;
enter_where(ep, pn);
}
- if (db)
+ if (db != NULL)
for (sflag = R_FIRST;; sflag = R_NEXT) {
PERSON *tmp;
@@ -290,3 +290,4 @@
enter_lastlog(tmp);
}
}
+
diff -r 95e219d61576 -r 8584523398df usr.bin/finger/lprint.c
--- a/usr.bin/finger/lprint.c Mon Aug 05 07:44:06 2002 +0000
+++ b/usr.bin/finger/lprint.c Mon Aug 05 08:04:03 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lprint.c,v 1.13 2002/08/02 00:10:40 christos Exp $ */
+/* $NetBSD: lprint.c,v 1.14 2002/08/05 08:04:03 tron Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID( "$NetBSD: lprint.c,v 1.13 2002/08/02 00:10:40 christos Exp $");
+__RCSID( "$NetBSD: lprint.c,v 1.14 2002/08/05 08:04:03 tron Exp $");
#endif
#endif /* not lint */
@@ -93,6 +93,9 @@
PERSON *tmp;
DBT data, key;
+ if (db == NULL)
+ return;
+
for (sflag = R_FIRST;; sflag = R_NEXT) {
r = (*db->seq)(db, &key, &data, sflag);
if (r == -1)
diff -r 95e219d61576 -r 8584523398df usr.bin/finger/sprint.c
--- a/usr.bin/finger/sprint.c Mon Aug 05 07:44:06 2002 +0000
+++ b/usr.bin/finger/sprint.c Mon Aug 05 08:04:03 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sprint.c,v 1.11 2002/08/02 00:10:40 christos Exp $ */
+/* $NetBSD: sprint.c,v 1.12 2002/08/05 08:04:03 tron Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: sprint.c,v 1.11 2002/08/02 00:10:40 christos Exp $");
+__RCSID("$NetBSD: sprint.c,v 1.12 2002/08/05 08:04:03 tron Exp $");
#endif
#endif /* not lint */
@@ -76,6 +76,9 @@
PERSON *tmp;
DBT data, key;
+ if (db == NULL)
+ return;
+
/*
* short format --
* login name
Home |
Main Index |
Thread Index |
Old Index