Subject: crontab bug
To: None <current-users@NetBSD.ORG>
From: Brook Milligan <brook@trillium.NMSU.Edu>
List: current-users
Date: 07/16/1997 16:43:11
I tried to use crontab(1) on a netbsd/i386 v1.2.1 system to install a
crontab for a user other than root.  Doing so, I discovered that it
was truncating usernames to 4 (= sizeof(User-1) = sizeof(PID_T))
instead of sizeof(User)-1 characters.  The patch to correct the
problem follows (a misplaced parenthesis in
src/usr.sbin/cron/crontab.c).

Does nobody use crontab(1) to install crontab files for "normal"
users?  I would have thought this bug would have surfaced long ago, or
is the netbsd crontab much out of date compared with vixie's?

===========================================================================
*** crontab.c.orig	Sun Mar  2 13:05:20 1997
--- crontab.c	Wed Jul 16 15:28:17 1997
***************
*** 168,174 ****
  					ProgramName, optarg);
  				exit(ERROR_EXIT);
  			}
! 			(void) strncpy(User, optarg, sizeof(User - 1));
  			User[sizeof(User) - 1] = '\0';
  			break;
  		case 'l':
--- 168,174 ----
  					ProgramName, optarg);
  				exit(ERROR_EXIT);
  			}
! 			(void) strncpy(User, optarg, sizeof(User) - 1);
  			User[sizeof(User) - 1] = '\0';
  			break;
  		case 'l':
===========================================================================