]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
fix off by one issue #913
authorTobias Oetiker <tobi@oetiker.ch>
Thu, 3 Jan 2019 11:02:08 +0000 (12:02 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Thu, 3 Jan 2019 12:59:39 +0000 (13:59 +0100)
src/rrd_xport.c

index cefc3f470ea71ee169eb1fa93311ca758a32ad72..006fbff6d58c784751612bc27cdadc55439c2f62 100644 (file)
@@ -630,9 +630,9 @@ static int rrd_xport_format_xmljson(int flags,stringbuffer_t *buffer,image_desc_
     }
   } else {
     if (json) {
-      snprintf(buf,sizeof(buf),"    \"%s\": %lld,\n",META_START_TAG,(long long int)start);
+      snprintf(buf,sizeof(buf),"    \"%s\": %lld,\n",META_START_TAG,(long long int)start+step);
     } else {
-      snprintf(buf,sizeof(buf),"    <%s>%lld</%s>\n",META_START_TAG,(long long int)start,META_START_TAG);
+      snprintf(buf,sizeof(buf),"    <%s>%lld</%s>\n",META_START_TAG,(long long int)start+step,META_START_TAG);
     }
   }
   addToBuffer(buffer,buf,0);
@@ -733,7 +733,7 @@ static int rrd_xport_format_xmljson(int flags,stringbuffer_t *buffer,image_desc_
   }
   addToBuffer(buffer,buf,0);
   /* iterate over data */
-  for (time_t ti = start; ti < end; ti += step) {
+  for (time_t ti = start+step; ti <= end; ti += step) {
     if (timefmt) {
       struct tm loc;
       localtime_r(&ti,&loc);