diff options
author | Dmitry V. Levin <ldv@strace.io> | 2023-12-27 22:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-12-27 22:00:00 +0000 |
commit | 8d95558f5286c4f58083078a1b85d60750d34b47 (patch) | |
tree | 7fe023ff0f9571d43f1bfa1985e7e40cb6adfebd /modules | |
parent | c12a2d00cc560ebdacc53bcedb6ee882baba5b1f (diff) | |
download | pam-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')
-rw-r--r-- | modules/pam_timestamp/pam_timestamp.c | 7 |
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; |