From e559de0cdd6134a4b87a79aab6928fb1e8c7194c Mon Sep 17 00:00:00 2001 From: Christian Göttsche Date: Thu, 22 Feb 2024 16:16:45 +0100 Subject: pam_unix: avoid string formatting of NULL Since the struct member user might be NULL use the same condition for the value as for the preceding key. Reported-by: Yugend --- modules/pam_unix/support.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules/pam_unix') diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c index 69811048..90f6bbe9 100644 --- a/modules/pam_unix/support.c +++ b/modules/pam_unix/support.c @@ -317,7 +317,8 @@ static void _cleanup_failures(pam_handle_t * pamh, void *fl, int err) tty ? (const char *)tty : "", ruser ? (const char *)ruser : "", rhost ? (const char *)rhost : "", (failure->user && failure->user[0] != '\0') - ? " user=" : "", failure->user + ? " user=" : "", + failure->user ? failure->user : "" ); if (failure->count > UNIX_MAX_RETRIES) { @@ -836,7 +837,7 @@ int _unix_verify_password(pam_handle_t * pamh, const char *name rhost ? (const char *)rhost : "", (new->user && new->user[0] != '\0') ? " user=" : "", - new->user + new->user ? new->user : "" ); new->count = 1; } -- cgit v1.2.3