[gnome-keyring] pam: Pass the correct argc to gkr_pam_client_run_operation



commit 0d283e5a743d5da6150601ba2228c7c3d9418acd
Author: Iain Lane <iain orangesquash org uk>
Date:   Tue May 10 12:46:21 2016 +0100

    pam: Pass the correct argc to gkr_pam_client_run_operation
    
    If there's no password then there are no arguments. This prevents a
    crash in keyring_daemon_op (), which loops over argv and would otherwise
    dereference a null pointer.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766222

 pam/gkr-pam-module.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/pam/gkr-pam-module.c b/pam/gkr-pam-module.c
index 38dba64..349aded 100644
--- a/pam/gkr-pam-module.c
+++ b/pam/gkr-pam-module.c
@@ -640,7 +640,8 @@ unlock_keyring (pam_handle_t *ph,
        control = get_any_env (ph, ENV_CONTROL);
        argv[0] = password;
 
-       res = gkr_pam_client_run_operation (pwd, control, GKD_CONTROL_OP_UNLOCK, 1, argv);
+       res = gkr_pam_client_run_operation (pwd, control, GKD_CONTROL_OP_UNLOCK,
+                                           (argv[0] == NULL) ? 0 : 1, argv);
        /* An error unlocking */
        if (res == GKD_CONTROL_RESULT_NO_DAEMON) {
                if (need_daemon)


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