aboutsummaryrefslogtreecommitdiff
path: root/libpam
diff options
context:
space:
mode:
authorEgor Ignatov <egori@altlinux.org>2024-05-30 14:03:20 +0300
committerEgor Ignatov <egori@altlinux.org>2024-05-30 14:30:46 +0300
commitefa6e33b1da594f2a2c4c2c8871416a3d5011015 (patch)
tree144b172fb626db81cecfa55a8add843e4dc1479b /libpam
parent8562cb1b951e7bd807af6b43d85c71cedd7b10d7 (diff)
downloadpam-efa6e33b1da594f2a2c4c2c8871416a3d5011015.tar.gz
pam-efa6e33b1da594f2a2c4c2c8871416a3d5011015.tar.bz2
pam-efa6e33b1da594f2a2c4c2c8871416a3d5011015.zip
pam_set_item: disallow setting service to NULL
This also prevents a possible segfault when pam_set_item tries to convert an empty service_name to lower case.
Diffstat (limited to 'libpam')
-rw-r--r--libpam/pam_item.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpam/pam_item.c b/libpam/pam_item.c
index ad736a4f..c3a5a3bd 100644
--- a/libpam/pam_item.c
+++ b/libpam/pam_item.c
@@ -38,6 +38,12 @@ int pam_set_item (pam_handle_t *pamh, int item_type, const void *item)
switch (item_type) {
case PAM_SERVICE:
+ if (item == NULL) {
+ pam_syslog(pamh, LOG_ERR,
+ "pam_set_item: attempt to set service to NULL");
+ retval = PAM_BAD_ITEM;
+ break;
+ }
/* Setting handlers_loaded to 0 will cause the handlers
* to be reloaded on the next call to a service module.
*/