]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
src/rrd_xport.c: fix Coverity CID#13640 Array compared against 0
authorMarek Schimara <Marek.Schimara@bull.net>
Fri, 17 Jun 2016 11:08:27 +0000 (13:08 +0200)
committerMarek Schimara <Marek.Schimara@bull.net>
Thu, 23 Jun 2016 14:32:33 +0000 (16:32 +0200)
        CWE-398 / https://cwe.mitre.org/data/definitions/398.html

        (im->gdes[i].legend == 0) doesn't make sense;
        im->gdes[i].legend declared as
          char      legend[FMT_LEG_LEN + 5];  /* legend */

        NOTE: fix to be checked to ensure it conserves the intended functionality.

src/rrd_xport.c

index 5573518611298bf2c43561e84004314503435250..59c469723511052cc8bde56bc54e0198c2e75026 100644 (file)
@@ -322,7 +322,7 @@ int rrd_xport_fn(
                 return (-1);
             }
 
-            if (im->gdes[i].legend == 0)
+            if (im->gdes[i].legend[0] == '\0')
                 legend_list[j][0] = '\0';
             ++j;
        }