Date: Wed, 29 Apr 2026 04:06:48 +0000 From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Chris Longros <chris.longros@gmail.com> Subject: git: 91bfba010bcd - main - cron: log when a crontab path is too long Message-ID: <69f183d8.18567.b59b7db@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=91bfba010bcda665cc24a76af631cc85fcb0c688 commit 91bfba010bcda665cc24a76af631cc85fcb0c688 Author: Chris Longros <chris.longros@gmail.com> AuthorDate: 2026-04-29 04:06:29 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2026-04-29 04:06:29 +0000 cron: log when a crontab path is too long Log via syslog when snprintf truncates the crontab path, instead of silently skipping the entry. Signed-off-by: Christos Longros <chris.longros@gmail.com> Reviewed by: bcr, kevans Differential Revision: https://reviews.freebsd.org/D56235 --- usr.sbin/cron/cron/cron.8 | 11 +++++++++-- usr.sbin/cron/cron/database.c | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/usr.sbin/cron/cron/cron.8 b/usr.sbin/cron/cron/cron.8 index 23a295393df5..f1a6a30d4cb5 100644 --- a/usr.sbin/cron/cron/cron.8 +++ b/usr.sbin/cron/cron/cron.8 @@ -19,7 +19,7 @@ .\" .\" $Id: cron.8,v 1.2 1998/08/14 00:32:36 vixie Exp $ .\" -.Dd January 20, 2026 +.Dd April 29, 2026 .Dt CRON 8 .Os .Sh NAME @@ -227,7 +227,14 @@ configuration file for .It Pa /usr/local/etc/cron.d Directory for third-party package provided crontab files. .It Pa /var/cron/tabs -Directory for personal crontab files +Directory for personal crontab files. +Internally the daemon constructs the relative path +.Pa tabs/ Ns Ar filename , +which must fit within +.Dv MAXNAMLEN +bytes; in practice this allows filenames up to 250 bytes. +Longer entries are skipped and a diagnostic is logged via +.Xr syslog 3 . .El .Sh SEE ALSO .Xr crontab 1 , diff --git a/usr.sbin/cron/cron/database.c b/usr.sbin/cron/cron/database.c index 35e5fad3524d..234b5ef7fdd6 100644 --- a/usr.sbin/cron/cron/database.c +++ b/usr.sbin/cron/cron/database.c @@ -166,8 +166,10 @@ load_database(cron_db *old_db) fname[sizeof(fname)-1] = '\0'; if (snprintf(tabname, sizeof tabname, CRON_TAB(fname)) - >= sizeof(tabname)) - continue; /* XXX log? */ + >= (int)sizeof(tabname)) { + log_it("CRON", getpid(), "TABNAME TOO LONG", fname); + continue; + } process_crontab(fname, fname, tabname, &statbuf, &new_db, old_db);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f183d8.18567.b59b7db>
