From 48d822f43167e9ea765ae7de341eeef8de07a013 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Sat, 9 Jul 2016 13:19:02 +0300 Subject: [PATCH] rrdtool_draw_image: Remove excess strlen() call 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 --- rrdtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rrdtool.c b/rrdtool.c index c875417..9fed184 100644 --- 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; -- 2.45.0