From 254e4e44cd7828fba8f5bb18a7a29668221e0af5 Mon Sep 17 00:00:00 2001 From: "John W. O'Brien" Date: Sat, 14 Mar 2020 08:49:47 -0400 Subject: [PATCH] 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. --- src/rrd_graph_helper.c | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- 2.47.2