]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fix double meaning of time 0 as uninitialized value 1079/head
authorJohn W. O'Brien <john@saltant.com>
Sat, 14 Mar 2020 12:49:47 +0000 (08:49 -0400)
committerJohn W. O'Brien <john@saltant.com>
Sat, 14 Mar 2020 12:49:47 +0000 (08:49 -0400)
Treat "VRULE:0#..." as "VRULE:1#..." because elsewhere xrule==0 is
used to mean xrule has not been set, which can lead to an array
bounds violation.

src/rrd_graph_helper.c

index ceb009a4389c42f36a1d29562d864b857f049285..f88893b4436b457d986200634dc1af4222886029 100644 (file)
@@ -1026,6 +1026,10 @@ static graph_desc_t *newGraphDescription(
                     }
                     if (gf == GF_VRULE) {
                         gdp->xrule = val;
+                        if (gdp->xrule == 0) {
+                            /* distinguish from uninitialized */
+                            gdp->xrule++;
+                        }
                     } else {
                         gdp->yrule = val;
                     }