aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-09-27 19:48:35 -0400
committerTony Hutter <[email protected]>2022-12-01 12:39:41 -0800
commit531361114bb6c0c6b98533499b8790f7cc1747f2 (patch)
tree65f601c7ccf5ae1ded519e72e25e2394e33c43cf
parente11c4327f12df0e1f3ae9a9187a7ee553d1d6e95 (diff)
PAM: Fix uninitialized value read
Clang's static analyzer found that config.uid is uninitialized when zfs_key_config_load() returns an error. Oddly, this was not included in the unchecked return values that Coverity found. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #13957
-rw-r--r--contrib/pam_zfs_key/pam_zfs_key.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/pam_zfs_key/pam_zfs_key.c b/contrib/pam_zfs_key/pam_zfs_key.c
index 703d0ad57..4b89091cd 100644
--- a/contrib/pam_zfs_key/pam_zfs_key.c
+++ b/contrib/pam_zfs_key/pam_zfs_key.c
@@ -768,7 +768,9 @@ pam_sm_close_session(pam_handle_t *pamh, int flags,
return (PAM_SUCCESS);
}
zfs_key_config_t config;
- zfs_key_config_load(pamh, &config, argc, argv);
+ if (zfs_key_config_load(pamh, &config, argc, argv) != 0) {
+ return (PAM_SESSION_ERR);
+ }
if (config.uid < 1000) {
zfs_key_config_free(&config);
return (PAM_SUCCESS);