]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
fixed overflow probem with partial matching
authorTobias Oetiker <tobi@oetiker.ch>
Tue, 19 Mar 2013 06:17:23 +0000 (07:17 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 19 Mar 2013 06:17:23 +0000 (07:17 +0100)
src/rrd_fetch.c

index 267fd952cb1e4860577eb10d2fbc2e6e9c7e9519..79f1d40225c51f9c8fdfe7ba4f5b0ef818f64c33 100644 (file)
@@ -374,8 +374,8 @@ int rrd_fetch_fn(
     rra_start_time = (rra_end_time
                       - (*step * (rrd.rra_def[chosen_rra].row_cnt - 1)));
     /* here's an error by one if we don't be careful */
-    start_offset = ((long) *start + *step - rra_start_time) / (long) *step;
-    end_offset = ((long) rra_end_time - *end) / (long) *step;
+    start_offset = ((long long) *start + (long long)*step - (long long)rra_start_time) / (long long) *step;
+    end_offset = ((long long) rra_end_time - (long long)*end) / (long long) *step;
 #ifdef DEBUG
     fprintf(stderr,
             "rra_start %lu, rra_end %lu, start_off %li, end_off %li\n",