Skip to content

Commit

Permalink
Fix null pointer dereferences in PAM
Browse files Browse the repository at this point in the history
Coverity caught these.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#13889
  • Loading branch information
ryao authored and andrewc12 committed Oct 1, 2022
1 parent e595150 commit ad34400
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/pam_zfs_key/pam_zfs_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ zfs_key_config_get_dataset(zfs_key_config_t *config)
if (zhp == NULL) {
pam_syslog(NULL, LOG_ERR, "dataset %s not found",
config->homes_prefix);
zfs_close(zhp);
return (NULL);
}

Expand All @@ -543,6 +542,10 @@ zfs_key_config_get_dataset(zfs_key_config_t *config)
return (dsname);
}

if (config->homes_prefix == NULL) {
return (NULL);
}

size_t len = ZFS_MAX_DATASET_NAME_LEN;
size_t total_len = strlen(config->homes_prefix) + 1
+ strlen(config->username);
Expand Down

0 comments on commit ad34400

Please sign in to comment.