Bug 298461 - login segfaults on EOF
Summary: login segfaults on EOF
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: 7
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2007-09-20 15:47 UTC by n0dalus
Modified: 2008-06-12 13:15 UTC (History)
1 user (show)

Fixed In Version: F8, F9 and rawhide
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-06-12 13:15:05 UTC
Type: ---

Attachments (Terms of Use)

Description n0dalus 2007-09-20 15:47:13 UTC
Description of problem:
login(1) has a segmentation fault when the input is an EOF:
$ login
login: ^D
login: ^D
Segmentation fault

Using gdb:
$ gdb login
(gdb) run
Starting program: /bin/login
login: ^D
login: ^D

Program received signal SIGSEGV, Segmentation fault.
0x0015e731 in _nss_files_getpwnam_r (name=0x0, result=0x8f8974, 
    buffer=0x9cac3c0 "root", buflen=1024, errnop=0xb7f96688)
    at nss_files/files-pwd.c:33
33      DB_LOOKUP (pwnam, 1 + strlen (name), (".%s", name),
(gdb) bt
#0  0x0015e731 in _nss_files_getpwnam_r (name=0x0, result=0x8f8974, 
    buffer=0x9cac3c0 "root", buflen=1024, errnop=0xb7f96688)
    at nss_files/files-pwd.c:33
#1  0x00836223 in __getpwnam_r (name=0x0, resbuf=0x8f8974, 
    buffer=0x9cac3c0 "root", buflen=1024, result=0xbfc915e8)
    at ../nss/getXXbyYY_r.c:210
#2  0x00835ca8 in getpwnam (name=0x0) at ../nss/getXXbyYY.c:116
#3  0x0804b83c in main (argc=0, argv=Cannot access memory at address 0x3e
) at login.c:612
#4  0x007bcf70 in __libc_start_main (main=0x8049f90 <main>, argc=1, 
    ubp_av=0xbfc93cf4, init=0x804c490 <__libc_csu_init>, 
    fini=0x804c480 <__libc_csu_fini>, rtld_fini=0x7963d0 <_dl_fini>, 
    stack_end=0xbfc93cec) at libc-start.c:222
#5  0x08049a21 in _start ()

Version-Release number of selected component (if applicable):

How reproducible:
Every time.

Comment 1 Karel Zak 2007-09-20 22:38:38 UTC
Hmm... bug in login audit code. Thanks!

diff --git a/login-utils/login.c b/login-utils/login.c
index e582779..1af8792 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -330,12 +330,12 @@ logaudit(const char *tty, const char *username, const char
        audit_fd = audit_open();
        if (audit_fd == -1)
-       if (!pwd)
+       if (!pwd && username)
                pwd = getpwnam(username);
        if (pwd)
                snprintf(buf, sizeof(buf), "uid=%d", pwd->pw_uid);
-               snprintf(buf, sizeof(buf), "acct=%s", username);
+               snprintf(buf, sizeof(buf), "acct=%s", username ? username :
        audit_log_user_message(audit_fd, AUDIT_USER_LOGIN,
                buf, hostname, NULL, tty, status);

Comment 2 Bug Zapper 2008-05-14 14:25:39 UTC
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Note You need to log in before you can comment on or make changes to this bug.