aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_timestamp
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2023-12-27 22:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2023-12-27 22:00:00 +0000
commit8d95558f5286c4f58083078a1b85d60750d34b47 (patch)
tree7fe023ff0f9571d43f1bfa1985e7e40cb6adfebd /modules/pam_timestamp
parentc12a2d00cc560ebdacc53bcedb6ee882baba5b1f (diff)
downloadpam-8d95558f5286c4f58083078a1b85d60750d34b47.tar.gz
pam-8d95558f5286c4f58083078a1b85d60750d34b47.tar.bz2
pam-8d95558f5286c4f58083078a1b85d60750d34b47.zip
pam_timestamp_check: check format_timestamp_name return value
* modules/pam_timestamp/pam_timestamp.c [PAM_TIMESTAMP_MAIN] (main): Bail out if format_timestamp_name returns an error.
Diffstat (limited to 'modules/pam_timestamp')
-rw-r--r--modules/pam_timestamp/pam_timestamp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c
index 1d624b40..bf35db15 100644
--- a/modules/pam_timestamp/pam_timestamp.c
+++ b/modules/pam_timestamp/pam_timestamp.c
@@ -845,8 +845,11 @@ main(int argc, char **argv)
}
/* Generate the name of the timestamp file. */
- format_timestamp_name(path, sizeof(path), TIMESTAMPDIR,
- tty, user, target_user);
+ if (format_timestamp_name(path, sizeof(path), TIMESTAMPDIR,
+ tty, user, target_user) >= (int) sizeof(path)) {
+ fprintf(stderr, "path too long\n");
+ return 4;
+ }
do {
retval = 0;