From: Ruben Kerkhof Date: Sun, 2 Jul 2017 20:12:18 +0000 (+0200) Subject: write_mongodb: fix build warning X-Git-Tag: collectd-5.8.0~118^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f81a5a84d3d5fc941b624c28b1ab70971cc23ac9;p=collectd.git write_mongodb: fix build warning CC src/write_mongodb_la-write_mongodb.lo src/write_mongodb.c: In function ‘wm_config’: src/write_mongodb.c:371:55: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 114 [-Wformat-truncation=] snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name); ^~ src/write_mongodb.c:371:5: note: ‘snprintf’ output between 15 and 142 bytes into a destination of size 128 snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- diff --git a/src/write_mongodb.c b/src/write_mongodb.c index 2cb4537b..37e34098 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -366,7 +366,7 @@ static int wm_config_node(oconfig_item_t *ci) /* {{{ */ } if (status == 0) { - char cb_name[DATA_MAX_NAME_LEN]; + char cb_name[sizeof("write_mongodb/") + DATA_MAX_NAME_LEN]; snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name);