From owner-svn-src-head@freebsd.org Fri Sep 2 03:15:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C114DBCC978; Fri, 2 Sep 2016 03:15:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7815515D; Fri, 2 Sep 2016 03:15:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u823FsBu099003; Fri, 2 Sep 2016 03:15:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u823FsAF099001; Fri, 2 Sep 2016 03:15:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609020315.u823FsAF099001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 2 Sep 2016 03:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305269 - in head/usr.sbin/cron: cron crontab X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2016 03:15:55 -0000 Author: emaste Date: Fri Sep 2 03:15:54 2016 New Revision: 305269 URL: https://svnweb.freebsd.org/changeset/base/305269 Log: 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 Modified: head/usr.sbin/cron/cron/cron.h head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/cron/cron.h ============================================================================== --- head/usr.sbin/cron/cron/cron.h Fri Sep 2 03:10:30 2016 (r305268) +++ head/usr.sbin/cron/cron/cron.h Fri Sep 2 03:15:54 2016 (r305269) @@ -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 */ Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Fri Sep 2 03:10:30 2016 (r305268) +++ head/usr.sbin/cron/crontab/crontab.c Fri Sep 2 03:15:54 2016 (r305269) @@ -28,6 +28,7 @@ static const char rcsid[] = #define MAIN_PROGRAM +#include #include "cron.h" #include #include @@ -57,7 +58,7 @@ static char *Options[] = { "???", "list" 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;