From: Tobias Oetiker Date: Thu, 3 Jan 2019 11:02:08 +0000 (+0100) Subject: fix off by one issue #913 X-Git-Tag: v1.7.1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fe4ab9c0878d37f1a9b740c9cd28e913697f78a;p=thirdparty%2Frrdtool-1.x.git fix off by one issue #913 --- diff --git a/src/rrd_xport.c b/src/rrd_xport.c index cefc3f47..006fbff6 100644 --- a/src/rrd_xport.c +++ b/src/rrd_xport.c @@ -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\n",META_START_TAG,(long long int)start,META_START_TAG); + snprintf(buf,sizeof(buf)," <%s>%lld\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);