]> git.itanic.dy.fi Git - rrdd/commitdiff
rrdtool_draw_image: Remove excess strlen() call
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 9 Jul 2016 10:19:02 +0000 (13:19 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 9 Jul 2016 10:19:02 +0000 (13:19 +0300)
strncat is already good enough ensuring target buffer will not
overflow. There is no need to use strlen at all.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
rrdtool.c

index c8754176fd66ac6855422356914103e7af6b1b47..9fed184cce5e649c6072973b417e3c24da4a594f 100644 (file)
--- a/rrdtool.c
+++ b/rrdtool.c
@@ -48,8 +48,8 @@ int rrdtool_draw_image(struct rrd_image *image)
        pr_info("Drawing image %s\n", image->image_filename);
 
        tmpfile[0] = 0;
-       strncat(tmpfile, image->image_filename, sizeof(tmp) - strlen(tmp) - 1);
-       strncat(tmpfile, ".tmp", sizeof(tmp) - strlen(tmp) - 1);
+       strncat(tmpfile, image->image_filename, sizeof(tmp) - 1);
+       strncat(tmpfile, ".tmp", sizeof(tmp) - 1);
 
        if (image->updatestr)
                updatestr = image->updatestr;