Code

redis plugin: make sure buffer is null-terminated
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 29 Nov 2015 16:52:26 +0000 (17:52 +0100)
committerMarc Fournier <marc.fournier@camptocamp.com>
Tue, 12 Jan 2016 07:12:06 +0000 (08:12 +0100)
CID 37938

src/redis.c

index 7864ead07c01c1edf079cecfb9c79474470cb277..a40d2cd2b48b9f0880f61f61a2177b6a476e1a22 100644 (file)
@@ -141,7 +141,7 @@ static redis_query_t *redis_config_query (oconfig_item_t *ci) /* {{{ */
      * Default to a gauge type.
      */
     (void)strncpy(rq->type, "gauge", sizeof(rq->type));
-    (void)strncpy(rq->instance, rq->query, sizeof(rq->instance));
+    (void)sstrncpy(rq->instance, rq->query, sizeof(rq->instance));
     replace_special(rq->instance, sizeof(rq->instance));
 
     for (i = 0; i < ci->children_num; i++) {