curl_json plugin: avoid unlikely overrun
authorJim Radford <radford@galvanix.com>
Sat, 10 Aug 2013 16:10:56 +0000 (09:10 -0700)
committerFlorian Forster <octo@collectd.org>
Mon, 19 Aug 2013 14:50:53 +0000 (16:50 +0200)
Signed-off-by: Florian Forster <octo@collectd.org>
src/curl_json.c

index deee460..89fce16 100644 (file)
@@ -500,6 +500,7 @@ static int cj_config_add_key (cj_t *db, /* {{{ */
         len = ptr-name;
         if (len == 0)
           break;
+        len = COUCH_MIN(len, sizeof (ent)-1);
         sstrncpy (ent, name, len+1);
 
         if (c_avl_get (tree, ent, (void *) &value) != 0)