From 43bdb7ce04c9cb00bdf0f5dda818b077b9dc7c56 Mon Sep 17 00:00:00 2001 From: Andrey Kovalev Date: Fri, 18 Oct 2024 10:25:17 +0300 Subject: pam_get_authtok*: disallow setting pamh to NULL This also prevents a potential NULL pointer dereference in pam_get_authtok_internal and pam_get_authtok_verify when the pamh argument they access is set to NULL. --- libpam/pam_get_authtok.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libpam') diff --git a/libpam/pam_get_authtok.c b/libpam/pam_get_authtok.c index c8973275..2e7a5996 100644 --- a/libpam/pam_get_authtok.c +++ b/libpam/pam_get_authtok.c @@ -84,6 +84,8 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item, unsigned int flags) { + IF_NO_PAMH(pamh, PAM_SYSTEM_ERR); + char *resp[2] = {NULL, NULL}; const void *prevauthtok; const char *authtok_type = ""; @@ -229,6 +231,8 @@ int pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok, const char *prompt) { + IF_NO_PAMH(pamh, PAM_SYSTEM_ERR); + char *resp = NULL; const char *authtok_type = ""; int retval; -- cgit v1.2.3