]> git.itanic.dy.fi Git - rrdd/commitdiff
config: Fix "specified bound 16 equals destination size" warning
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Wed, 29 Jan 2020 18:01:38 +0000 (20:01 +0200)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Wed, 29 Jan 2020 18:01:38 +0000 (20:01 +0200)
Just subtract one byte off the strncpy destination size and the null
byte will always fit.

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

index 81ba1880c64cd9a77938efe4ea16a3c413eb692a..fec0454bff98e6016f50ecef5cedadd311381716 100644 (file)
--- a/config.c
+++ b/config.c
@@ -129,11 +129,11 @@ static int parse_images(config_setting_t *list, struct rrd_database *db)
                db->images[i]->width            = width;
                db->images[i]->height           = height;
                strncpy(db->images[i]->timestart, timestart,
-                       sizeof(db->images[i]->timestart));
+                       sizeof(db->images[i]->timestart) - 1);
                strncpy(db->images[i]->timeend, timeend,
-                       sizeof(db->images[i]->timeend));
+                       sizeof(db->images[i]->timeend) - 1);
                strncpy(db->images[i]->imageformat, imageformat,
-                       sizeof(db->images[i]->imageformat));
+                       sizeof(db->images[i]->imageformat) - 1);
                db->images[i]->options          = options;
                db->images[i]->text_lead        = text_lead;
                db->images[i]->text             = text;