summaryrefslogtreecommitdiff
path: root/usr.bin/at/at.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-06-03 19:19:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-06-03 19:19:08 +0000
commitb5a76938c4b9db98f6f2841cc4d086149897837b (patch)
tree78f94a9fa885f001bc6c3274b544fa0496ba9231 /usr.bin/at/at.c
parent8900be75bbae4e85014a3ff9708e278356e91598 (diff)
Verify that argc > 0 before trying to use argv and mark usage as __dead.
from Dmitry V. Levin
Diffstat (limited to 'usr.bin/at/at.c')
-rw-r--r--usr.bin/at/at.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index a8816599734..689d1c8cc80 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.40 2003/09/26 21:26:40 tedu Exp $ */
+/* $OpenBSD: at.c,v 1.41 2004/06/03 19:19:07 millert Exp $ */
/*
* at.c : Put file into atrun queue
@@ -42,7 +42,7 @@
#define TIMESIZE 50 /* Size of buffer passed to strftime() */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: at.c,v 1.40 2003/09/26 21:26:40 tedu Exp $";
+static const char rcsid[] = "$OpenBSD: at.c,v 1.41 2004/06/03 19:19:07 millert Exp $";
#endif
/* Variables to remove from the job's environment. */
@@ -71,7 +71,7 @@ static int check_permission(void);
static void panic(const char *);
static void perr(const char *);
static void perr2(const char *, const char *);
-static void usage(void);
+static __dead void usage(void);
time_t parsetime(int, char **);
/*
@@ -878,7 +878,7 @@ check_permission(void)
return (ok);
}
-static void
+static __dead void
usage(void)
{
/* Print usage and exit. */
@@ -921,6 +921,9 @@ main(int argc, char **argv)
int cflag = 0;
int nflag = 0;
+ if (argc < 1)
+ usage();
+
if ((ProgramName = strrchr(argv[0], '/')) != NULL)
ProgramName++;
else