aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/cron/crontab
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2016-09-02 03:15:54 +0000
committerEd Maste <emaste@FreeBSD.org>2016-09-02 03:15:54 +0000
commit5e5d4b233a27f6d6e345159ac68cc40449a2fd4a (patch)
tree20d0d89fe4469a4d84ecabdb2d10923707c14a57 /usr.sbin/cron/crontab
parenta19105157759c43629895b420d6179b3fe8ffb00 (diff)
downloadsrc-5e5d4b233a27f6d6e345159ac68cc40449a2fd4a.tar.gz
src-5e5d4b233a27f6d6e345159ac68cc40449a2fd4a.zip
cron: use existing maximum username constant MAXLOGNAME
Previously cron had its own maximum username length limit, which was smaller than the system's MAXLOGNAME. This could lead to crontab -u updating the wrong user's crontab (if the name was truncated, and matched another user). PR: 212305 Reported by: Andrii Kuzik Reviewed by: allanjude, jilles MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7747
Notes
Notes: svn path=/head/; revision=305269
Diffstat (limited to 'usr.sbin/cron/crontab')
-rw-r--r--usr.sbin/cron/crontab/crontab.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c
index 2608be711cef..933450b9b4d5 100644
--- a/usr.sbin/cron/crontab/crontab.c
+++ b/usr.sbin/cron/crontab/crontab.c
@@ -28,6 +28,7 @@ static const char rcsid[] =
#define MAIN_PROGRAM
+#include <sys/param.h>
#include "cron.h"
#include <errno.h>
#include <fcntl.h>
@@ -57,7 +58,7 @@ static char *Options[] = { "???", "list", "delete", "edit", "replace" };
static PID_T Pid;
-static char User[MAX_UNAME], RealUser[MAX_UNAME];
+static char User[MAXLOGNAME], RealUser[MAXLOGNAME];
static char Filename[MAX_FNAME];
static FILE *NewCrontab;
static int CheckErrorCount;