From b1b227fa5e00d08af047ab9a012211b66c6b0f13 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Fri, 15 May 2015 10:25:18 +0200 Subject: ripe-atlas-fw: imported version 4610 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- miscutils/perd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'miscutils') 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 @@ -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; -- cgit v1.2.3