summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Lane <iain@orangesquash.org.uk>2016-05-10 12:46:21 +0100
committerStef Walter <stefw@gnome.org>2016-05-12 14:48:22 +0200
commit0d283e5a743d5da6150601ba2228c7c3d9418acd (patch)
treecef6a50c51b3590f5e47ea56f4022c24646b5823
parent0baccbec4c9adc589f990270a2b47cc49bcd20ad (diff)
downloadgnome-keyring-0d283e5a743d5da6150601ba2228c7c3d9418acd.tar.gz
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
-rw-r--r--pam/gkr-pam-module.c3
1 files changed, 2 insertions, 1 deletions
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)