Subject: bin/28958: lastlogin -t causes a memory fault
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <kluis@free.fr>
List: netbsd-bugs
Date: 01/14/2005 03:12:00
>Number: 28958
>Category: bin
>Synopsis: lastlogin -t causes a memory fault
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 14 03:12:00 +0000 2005
>Originator: Karim Ayad
>Release: NetBSD 2.0
>Organization:
>Environment:
NetBSD netix 2.0 NetBSD 2.0 (GENERIC_LAPTOP) # 0 Wed Dec 1 11:01:08 UTC 2004 builds@build:/big/builds/ab/netbsd-2-0-RELEASE/i386/2004/11/300000Z-obj/big/builds/ab/netbsd-2-0-RELEASE/src/sys/arch/i386/compile/GENERIC_LAPTOP i386
>Description:
If I erase the contents of the file /var/log/lastlog, lastlogin -t causes a memory fault.
>How-To-Repeat:
root# echo -n "" /var/log/lastlog
root# lastlogin -t
Memory Fault (core dumped)
>Fix:
--- /usr/src/usr.sbin/lastlogin/lastlogin.c 2005-01-14 04:09:23.000000000 +0100
+++ /usr/srcnew/usr.sbin/lastlogin/lastlogin.c 2005-01-14 02:39:49.000000000 +0100
@@ -140,7 +140,8 @@
setpassent(0); /* Close passwd file pointers */
if (DOSORT(sortlog))
- sortoutput(outstack);
+ if(outstack != NULL)
+ sortoutput(outstack);
fclose(fp);
exit(0);