Re: [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]

 



On St, 2014-08-13 at 14:27 +0200, Robin Hack wrote:
> ---
>  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;

I do not understand the purpose of this patch. The terminal_line cannot
be NULL because in case the pam_get_item fails or returns NULL in
void_terminal_line the DEFAULT_TERM constant is used.

-- 
Tomas Mraz
No matter how far down the wrong road you've gone, turn back.
                                              Turkish proverb
(You'll never know whether the road is wrong though.)


_______________________________________________
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