From: Nick Date: Sat, 9 Feb 2013 18:46:40 +0000 (+0000) Subject: Added check for graph timespan overflowing if time_t is 32 bits. X-Git-Tag: 1.4.8~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f860a1c88ad1eb2d46b69c9b5fe9f357d2f9d28e;p=thirdparty%2Frrdtool-1.x.git Added check for graph timespan overflowing if time_t is 32 bits. Conflicts: src/rrd_create.c --- diff --git a/src/rrd_create.c b/src/rrd_create.c index 50e26652..77b550db 100644 --- a/src/rrd_create.c +++ b/src/rrd_create.c @@ -11,6 +11,8 @@ #include "rrd_tool.h" #include "rrd_rpncalc.h" #include "rrd_hw.h" +#include "rrd_client.h" +#include "../rrd_config.h" #include "rrd_is_thread_safe.h" static int opt_no_overwrite = 0; @@ -441,6 +443,12 @@ int rrd_create_r( row_cnt = atoi(token); if (row_cnt <= 0) rrd_set_error("Invalid row count: %i", row_cnt); +#if SIZEOF_TIME_T == 4 + if ((long long) pdp_step * rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt * row_cnt > 4294967296){ + /* database timespan > 2**32, would overflow time_t */ + rrd_set_error("The time spanned by the database is too large: must be <= 4294967296 seconds"); + } +#endif rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt = row_cnt; break; }