]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
src/rrd_graph_helper.c: fix Coverity CID#26527 Buffer not null terminated
authorMarek Schimara <Marek.Schimara@bull.net>
Thu, 16 Jun 2016 11:31:26 +0000 (13:31 +0200)
committerMarek Schimara <Marek.Schimara@bull.net>
Thu, 23 Jun 2016 14:32:33 +0000 (16:32 +0200)
        CWE-170 / https://cwe.mitre.org/data/definitions/170.html

src/rrd_graph_helper.c

index 0415af79ebd1c14f724639ccf1de04fdd2bda2d9..422839f3e23620f32a4f4395c6d079afc3590e64 100644 (file)
@@ -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) {