diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-03-12 18:15:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-03-12 18:15:56 +0000 |
commit | b12b5185e53f9e4e2fb29883e70b58e689a3c7bd (patch) | |
tree | 57794c3190046fd8f53c352cd62f6943d80bef7f | |
parent | 376adc3bc03a8421726053719731a55f9efedd58 (diff) |
Move range sanity check out of get_number() and into get_range() since
it was causing problems with symbolic names (and get_range() is really
where it belongs anyway). Also allow a range to be followed by a ','
as pointed out by mpech@
-rw-r--r-- | usr.sbin/cron/entry.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.sbin/cron/entry.c b/usr.sbin/cron/entry.c index 42205690698..64e8e746cea 100644 --- a/usr.sbin/cron/entry.c +++ b/usr.sbin/cron/entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entry.c,v 1.23 2003/03/11 17:54:06 millert Exp $ */ +/* $OpenBSD: entry.c,v 1.24 2003/03/12 18:15:55 millert Exp $ */ /* * Copyright 1988,1990,1993,1994 by Paul Vixie @@ -23,7 +23,7 @@ */ #if !defined(lint) && !defined(LINT) -static char const rcsid[] = "$OpenBSD: entry.c,v 1.23 2003/03/11 17:54:06 millert Exp $"; +static char const rcsid[] = "$OpenBSD: entry.c,v 1.24 2003/03/12 18:15:55 millert Exp $"; #endif /* vix 26jan87 [RCS'd; rest of log is in RCS file] @@ -482,8 +482,8 @@ get_range(bitstr_t *bits, int low, int high, const char *names[], /* get the number following the dash */ - ch = get_number(&num2, num1, names, ch, file, "/, \t\n"); - if (ch == EOF) + ch = get_number(&num2, low, names, ch, file, "/, \t\n"); + if (ch == EOF || num1 > num2) return (EOF); } } @@ -502,7 +502,7 @@ get_range(bitstr_t *bits, int low, int high, const char *names[], * element id, it's a step size. 'low' is * sent as a 0 since there is no offset either. */ - ch = get_number(&num3, 0, PPC_NULL, ch, file, " \t\n"); + ch = get_number(&num3, 0, PPC_NULL, ch, file, ", \t\n"); if (ch == EOF || num3 == 0) return (EOF); } else { @@ -547,8 +547,6 @@ get_number(int *numptr, int low, const char *names[], char ch, FILE *file, if (!strchr(terms, ch)) goto bad; *numptr = atoi(temp); - if (*numptr < low) - goto bad; return (ch); } |