summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2005-02-14 14:09:21 +0000
committerdelphij <delphij@FreeBSD.org>2005-02-14 14:09:21 +0000
commit1fdabdab98397eff29aca3b662558f692b7ac584 (patch)
treefec500e963d3164b2b8fe4c914d42f1cf1ddcd75 /usr.sbin/cron
parent8c12be1b6054637d08d9bf43c6a77866c5b641b2 (diff)
downloadFreeBSD-src-1fdabdab98397eff29aca3b662558f692b7ac584.zip
FreeBSD-src-1fdabdab98397eff29aca3b662558f692b7ac584.tar.gz
Fix parsing of '0' and non-alphanumerics in steps. Previously, an
entry having stepping value of zero can cause crontab to hang there, and if the main crontab is being changed in this way, then cron(8) will keep spining. Obtained from: OpenBSD [src/usr.sbin/cron/entry.c,v 1.17] PR: 68683 (my own, but forgot to commit it...) MFC After: 1 week
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r--usr.sbin/cron/lib/entry.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/cron/lib/entry.c b/usr.sbin/cron/lib/entry.c
index 2b886ee..216e837 100644
--- a/usr.sbin/cron/lib/entry.c
+++ b/usr.sbin/cron/lib/entry.c
@@ -543,7 +543,7 @@ get_range(bits, low, high, names, ch, file)
* sent as a 0 since there is no offset either.
*/
ch = get_number(&num3, 0, PPC_NULL, ch, file);
- if (ch == EOF)
+ if (ch == EOF || num3 == 0)
return EOF;
} else {
/* no step. default==1.
@@ -592,6 +592,8 @@ get_number(numptr, low, names, ch, file)
ch = get_char(file);
}
*pc = '\0';
+ if (len == 0)
+ return (EOF);
/* try to find the name in the name list
*/
OpenPOWER on IntegriCloud