diff options
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/perd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/miscutils/perd.c b/miscutils/perd.c index 1058dea..3a7b496 100644 --- a/miscutils/perd.c +++ b/miscutils/perd.c @@ -43,6 +43,8 @@ #define MAXLINES 256 /* max lines in non-root crontabs */ #endif +#define MAX_INTERVAL (2*366*24*3600) /* No intervals bigger than 2 years */ + #ifdef ATLAS #include <cmdtable.h> @@ -674,10 +676,9 @@ static void SynchronizeFile(const char *fileName) line->start_time= strtoul(tokens[1], &check1, 10); line->end_time= strtoul(tokens[2], &check2, 10); - line->nextcycle= (now-line->start_time)/ - line->interval + 1; - - if (check0[0] != '\0' || + if (line->interval <= 0 || + line->interval > MAX_INTERVAL || + check0[0] != '\0' || check1[0] != '\0' || check2[0] != '\0') { @@ -686,6 +687,9 @@ static void SynchronizeFile(const char *fileName) continue; } + line->nextcycle= (now-line->start_time)/ + line->interval + 1; + if (strcmp(tokens[3], "NONE") == 0) { line->distribution= DISTR_NONE; |