diff options
author | emaste <emaste@FreeBSD.org> | 2016-09-05 15:43:22 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-09-05 15:43:22 +0000 |
commit | 3b33ca08743db03bde702396083b670015dff9c9 (patch) | |
tree | 3f07cabe9724f384a72efa8af4871f3c5d143675 /usr.sbin | |
parent | 1607ddf6f3616915773c73484c679fb7778fdb9f (diff) | |
download | FreeBSD-src-3b33ca08743db03bde702396083b670015dff9c9.zip FreeBSD-src-3b33ca08743db03bde702396083b670015dff9c9.tar.gz |
MFC r305269: 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
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/cron/cron/cron.h | 1 | ||||
-rw-r--r-- | usr.sbin/cron/crontab/crontab.c | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/cron/cron/cron.h b/usr.sbin/cron/cron/cron.h index 1a814df..60b2a90 100644 --- a/usr.sbin/cron/cron/cron.h +++ b/usr.sbin/cron/cron/cron.h @@ -73,7 +73,6 @@ #define MAX_COMMAND 1000 /* max length of internally generated cmd */ #define MAX_ENVSTR 1000 /* max length of envvar=value\0 strings */ #define MAX_TEMPSTR 100 /* obvious */ -#define MAX_UNAME 20 /* max length of username, should be overkill */ #define ROOT_UID 0 /* don't change this, it really must be root */ #define ROOT_USER "root" /* ditto */ #define SYS_NAME "*system*" /* magic owner name for system crontab */ diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c index 2608be7..933450b 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; |