From: Tobias Oetiker Date: Thu, 23 Apr 2015 15:15:07 +0000 (+0200) Subject: VDEF paramerters are vnames and not ds_nam elements ... hence they can be much longer X-Git-Tag: v1.5.2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7026d67d289dae2a5c37adac8ef61901ada7621;p=thirdparty%2Frrdtool-1.x.git VDEF paramerters are vnames and not ds_nam elements ... hence they can be much longer --- diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index fa3be141..4a227603 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -986,23 +986,24 @@ int parse_cvdef(enum gf_en gf,parsedargs_t*pa,image_desc_t *const im){ /* parse rpn */ if ((gdp->rpnp= rpn_parse((void *) im, gdp->rpn, &find_var_wrapper)) == NULL) { return 1; } - } else { + } else { /* VDEF */ /* parse vdef, as vdef_parse is a bit "stupid" right now we have to touch things here */ /* so find first , */ char*c=strchr(gdp->rpn,','); + char vname[MAX_VNAME_LEN+1]; if (! c) { rrd_set_error("Comma expected in VDEF definition %s",gdp->rpn); return 1;} - /* found a comma, so copy the first part to ds_name (re/abusing it) */ - *c=0; - strncpy(gdp->ds_nam,gdp->rpn,DS_NAM_SIZE); - *c=','; + /* found a comma, so copy the first part to ds_nam (re/abusing it) */ + *c=0; /* yes now it seems as if the string ended here */ + strncpy(vname,gdp->rpn,MAX_VNAME_LEN); + *c=','; /* and now all is back to normal ... shudder */ /* trying to find the vidx for that name */ - gdp->vidx = find_var(im, gdp->ds_nam); + gdp->vidx = find_var(im, vname); if (gdp->vidx<0) { *c=','; - rrd_set_error("Not a valid vname: %s in line %s", gdp->ds_nam, gdp->rpn); + rrd_set_error("Not a valid vname: %s in line %s", vname, gdp->rpn); return 1;} if (im->gdes[gdp->vidx].gf != GF_DEF && im->gdes[gdp->vidx].gf != GF_CDEF) { rrd_set_error("variable '%s' not DEF nor " - "CDEF in VDEF '%s'", gdp->ds_nam, gdp->rpn); + "CDEF in VDEF '%s'",vname, gdp->rpn); return 1; } /* and parsing the rpn */