[PATCH 4/4] pam_lastlog: Fix potential segfault when terminal_line is NULL.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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

_______________________________________________
Pam-list mailing list
Pam-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/pam-list




[Index of Archives]     [Fedora Users]     [Kernel]     [Red Hat Install]     [Linux for the blind]     [Gimp]

  Powered by Linux