]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fix a signedness/unsignedness conversion bug in the expression 750/head
authorHavard Eidnes <he@uninett.no>
Tue, 18 Oct 2016 21:12:29 +0000 (23:12 +0200)
committerHavard Eidnes <he@uninett.no>
Tue, 18 Oct 2016 21:12:29 +0000 (23:12 +0200)
calculating "now" before printout of the timestamp.  Negative values
are first cast to unsigned, it seems, causing overflow.

src/rrd_dump.c

index de775513334dbd3b2f1d93951b7ced6c6679bb9d..bc8264215ae2181767ebeda1083e428321e526e1 100644 (file)
@@ -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