From bb5d0f69c7a29380f9fd05ac9c379c128bccdeca Mon Sep 17 00:00:00 2001 From: Fmiard Date: Thu, 21 Dec 2023 23:45:06 +0800 Subject: pam_timestamp_check: fix potential null pointer dereference on error path * modules/pam_timestamp/pam_timestamp.c [PAM_TIMESTAMP_MAIN] (main): Bail out early if getpwuid fails. --- modules/pam_timestamp/pam_timestamp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/pam_timestamp') diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c index 4bb556e4..644dfb49 100644 --- a/modules/pam_timestamp/pam_timestamp.c +++ b/modules/pam_timestamp/pam_timestamp.c @@ -815,7 +815,8 @@ main(int argc, char **argv) /* Get the name of the invoking (requesting) user. */ pwd = getpwuid(getuid()); if (pwd == NULL) { - retval = 4; + fprintf(stderr, "unknown user\n"); + return 4; } #ifdef USE_LOGIND uid = pwd->pw_uid; -- cgit v1.2.3