aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2015-05-15 10:25:18 +0200
committerBjørn Mork <bjorn@mork.no>2015-05-15 10:25:18 +0200
commitb1b227fa5e00d08af047ab9a012211b66c6b0f13 (patch)
tree5d891e417ab726a2627dccc40586c43f64b87e55 /miscutils
parentc9c35747c0d20cff54561c0b8fe15813c7a8e0ff (diff)
ripe-atlas-fw: imported version 46104610
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/perd.c12
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;