[PATCH 4/4] pam_lastlog: Fix potential segfault when terminal_line is NULL.
Robin Hack <[email protected]> Wed, 13 Aug 2014 14:27:48 +0200
| Newsgroups | gmane.linux.pam |
|---|---|
| Message-ID | <[email protected]> |
---
modules/pam_lastlog/pam_lastlog.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/pam_lastlog/pam_lastlog.c b/modules/pam_lastlog/pam_lastlog.c
index 50d33e4..1bd6d65 100644
--- a/modules/pam_lastlog/pam_lastlog.c
+++ b/modules/pam_lastlog/pam_lastlog.c
@@ -176,12 +176,16 @@ get_tty(pam_handle_t *pamh)
if (pam_get_item(pamh, PAM_TTY, &void_terminal_line) != PAM_SUCCESS
|| void_terminal_line == NULL) {
terminal_line = DEFAULT_TERM;
+ D(("terminal = %s", terminal_line));
+ return terminal_line;
} else {
terminal_line = void_terminal_line;
+ D(("terminal = %s", terminal_line));
+ return terminal_line;
}
if (!strncmp("/dev/", terminal_line, 5)) {
- /* strip leading "/dev/" from tty. */
- terminal_line += 5;
+ /* strip leading "/dev/" from tty. */
+ terminal_line += 5;
}
D(("terminal = %s", terminal_line));
return terminal_line;
--
1.9.3