diff options
| author | 1996-08-07 06:18:09 +0000 | |
|---|---|---|
| committer | 1996-08-07 06:18:09 +0000 | |
| commit | 219296e298ea96e6efd970f9f2a583d455a6b6b2 (patch) | |
| tree | c220cf1426ea9feed9ba8dd5cdfcfeee8df8a3b1 /usr.sbin/cron/crontab.c | |
| parent | woof (diff) | |
| download | wireguard-openbsd-219296e298ea96e6efd970f9f2a583d455a6b6b2.tar.xz wireguard-openbsd-219296e298ea96e6efd970f9f2a583d455a6b6b2.zip | |
buf oflow, nice error message; from freebsd
Diffstat (limited to 'usr.sbin/cron/crontab.c')
| -rw-r--r-- | usr.sbin/cron/crontab.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index 46b47f0e44d..2a5491385f6 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -16,7 +16,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: crontab.c,v 1.1.1.1 1995/10/18 08:47:30 deraadt Exp $"; +static char rcsid[] = "$Id: crontab.c,v 1.2 1996/08/07 06:18:09 deraadt Exp $"; #endif /* crontab - install and manage per-user crontab files @@ -143,7 +143,7 @@ parse_args(argc, argv) fprintf(stderr, "bailing out.\n"); exit(ERROR_EXIT); } - strcpy(User, pw->pw_name); + strncpy(User, pw->pw_name, sizeof User); strcpy(RealUser, User); Filename[0] = '\0'; Option = opt_unknown; @@ -166,7 +166,7 @@ parse_args(argc, argv) ProgramName, optarg); exit(ERROR_EXIT); } - (void) strcpy(User, optarg); + (void) strncpy(User, optarg, sizeof User); break; case 'l': if (Option != opt_unknown) @@ -197,7 +197,7 @@ parse_args(argc, argv) } else { if (argv[optind] != NULL) { Option = opt_replace; - (void) strcpy (Filename, argv[optind]); + (void) strncpy (Filename, argv[optind], sizeof Filename); } else { usage("file name must be specified for replace"); } @@ -473,7 +473,8 @@ edit_cmd() { ProgramName, Filename); goto done; default: - fprintf(stderr, "%s: panic: bad switch() in replace_cmd()\n"); + fprintf(stderr, "%s: panic: bad switch() in replace_cmd()\n", + ProgramName); goto fatal; } remove: |
