From: John W. O'Brien Date: Sat, 14 Mar 2020 12:49:47 +0000 (-0400) Subject: Fix double meaning of time 0 as uninitialized value X-Git-Tag: v1.8.0~42^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1079%2Fhead;p=thirdparty%2Frrdtool-1.x.git Fix double meaning of time 0 as uninitialized value 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. --- diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index ceb009a4..f88893b4 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -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; }