summaryrefslogtreecommitdiff
path: root/modules/pam_motd
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-04-26 11:12:59 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-04-26 11:12:59 +0000
commitc2c0434bd634a817f2b16ce7f58fc96c04e88b03 (patch)
tree78849930930dd58433ba8da87a0f70e2ffbe4d8a /modules/pam_motd
parent49b9d3039dc63f9c7e0dec51997ac2dc7f1e8703 (diff)
pam_motd: fix NULL dereference when at least one of motd directories is not available
* modules/pam_motd/pam_motd.c (try_to_display_directories_with_overrides): Do not assign -1U to dirscans_sizes[i] when scandir(motd_dir_path_split[i]) returns an error. Resolves: https://bugzilla.altlinux.org/38389 Fixes: d57ab221 ("pam_motd: Cleanup the code and avoid unnecessary logging")
Diffstat (limited to 'modules/pam_motd')
-rw-r--r--modules/pam_motd/pam_motd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/pam_motd/pam_motd.c b/modules/pam_motd/pam_motd.c
index df09b7d0..8147c6fd 100644
--- a/modules/pam_motd/pam_motd.c
+++ b/modules/pam_motd/pam_motd.c
@@ -219,6 +219,7 @@ static void try_to_display_directories_with_overrides(pam_handle_t *pamh,
pam_syslog(pamh, LOG_ERR, "error scanning directory %s: %m",
motd_dir_path_split[i]);
}
+ } else {
dirscans_sizes[i] = rv;
}
dirscans_size_total += dirscans_sizes[i];