From: Marek Schimara Date: Thu, 16 Jun 2016 11:31:26 +0000 (+0200) Subject: src/rrd_graph_helper.c: fix Coverity CID#26527 Buffer not null terminated X-Git-Tag: v1.7.0~42^2~32 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=6275c9e1fdf5de5f558a7d0bfbe3bed52a400cf1;p=thirdparty%2Frrdtool-1.x.git src/rrd_graph_helper.c: fix Coverity CID#26527 Buffer not null terminated CWE-170 / https://cwe.mitre.org/data/definitions/170.html --- diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 0415af79..422839f3 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -1235,7 +1235,8 @@ int parse_gprint(enum gf_en gf,parsedargs_t*pa,image_desc_t *const im) { dprintfparsed("Processing positional vname\n"); keyvalue_t* first=getFirstUnusedArgument(1,pa); if (first) { - strncpy(gdp->vname,first->keyvalue,MAX_VNAME_LEN + 1); + strncpy(gdp->vname,first->keyvalue,MAX_VNAME_LEN); + gdp->vname[MAX_VNAME_LEN] = '\0'; /* get type of reference */ gdp->vidx=find_var(im, gdp->vname); if (gdp->vidx<0) {