diff options
author | jon <jon@FreeBSD.org> | 2009-08-30 05:12:37 +0000 |
---|---|---|
committer | jon <jon@FreeBSD.org> | 2009-08-30 05:12:37 +0000 |
commit | 33cb329cc25fa22692d1ff44d1a47c280be8f36a (patch) | |
tree | 8829b51bb3c24bff29d67202121889cb73158e7e /lib/libpam/modules | |
parent | e888e87097a7cec9033b618fd32b4ac0f4e5c43f (diff) | |
download | FreeBSD-src-33cb329cc25fa22692d1ff44d1a47c280be8f36a.zip FreeBSD-src-33cb329cc25fa22692d1ff44d1a47c280be8f36a.tar.gz |
Prevents pam_lastlog from segfaulting on session close when tty is null.
MFC after: 1 month
Diffstat (limited to 'lib/libpam/modules')
-rw-r--r-- | lib/libpam/modules/pam_lastlog/pam_lastlog.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c index 817d1f3..9899f8d 100644 --- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c +++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c @@ -183,6 +183,11 @@ pam_sm_close_session(pam_handle_t *pamh __unused, int flags __unused, pam_err = pam_get_item(pamh, PAM_TTY, (const void **)&tty); if (pam_err != PAM_SUCCESS) goto err; + if (tty == NULL) { + PAM_LOG("No PAM_TTY"); + pam_err = PAM_SERVICE_ERR; + goto err; + } if (strncmp(tty, _PATH_DEV, strlen(_PATH_DEV)) == 0) tty = (const char *)tty + strlen(_PATH_DEV); if (*(const char *)tty == '\0') |