From 0d283e5a743d5da6150601ba2228c7c3d9418acd Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Tue, 10 May 2016 12:46:21 +0100 Subject: 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 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pam/gkr-pam-module.c b/pam/gkr-pam-module.c index 38dba64f..349aded3 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) -- cgit v1.2.1