From e1939757ab7c7d865f68106189921eb3021cd0d0 Mon Sep 17 00:00:00 2001 From: Havard Eidnes Date: Tue, 18 Oct 2016 23:12:29 +0200 Subject: [PATCH] Fix a signedness/unsignedness conversion bug in the expression calculating "now" before printout of the timestamp. Negative values are first cast to unsigned, it seems, causing overflow. --- src/rrd_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rrd_dump.c b/src/rrd_dump.c index de775513..bc826421 100644 --- a/src/rrd_dump.c +++ b/src/rrd_dump.c @@ -411,7 +411,7 @@ int rrd_dump_cb_r( now = (rrd.live_head->last_up - rrd.live_head->last_up % (rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step)) - + (timer * rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step); + + (timer * (long)rrd.rra_def[i].pdp_cnt * (long)rrd.stat_head->pdp_step); timer++; #if HAVE_STRFTIME -- 2.47.2