aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_timestamp/pam_timestamp.c
diff options
context:
space:
mode:
authorFmiard <yzd50036@gmail.com>2023-12-21 23:45:06 +0800
committerDmitry V. Levin <ldv@strace.io>2023-12-24 08:00:00 +0000
commitbb5d0f69c7a29380f9fd05ac9c379c128bccdeca (patch)
tree9decd5813f49b3b59370b474d2215837d0b6d8fd /modules/pam_timestamp/pam_timestamp.c
parent2d34803074153b5adc2ddca11ed0ef99d8b7d5b0 (diff)
downloadpam-bb5d0f69c7a29380f9fd05ac9c379c128bccdeca.tar.gz
pam-bb5d0f69c7a29380f9fd05ac9c379c128bccdeca.tar.bz2
pam-bb5d0f69c7a29380f9fd05ac9c379c128bccdeca.zip
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.
Diffstat (limited to 'modules/pam_timestamp/pam_timestamp.c')
-rw-r--r--modules/pam_timestamp/pam_timestamp.c3
1 files changed, 2 insertions, 1 deletions
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;