Code

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 deee460bb3327e6291d6536190ac68e7a7d87cb0..89fce164e02b0bdd96855a6a670ffa7d5dd810b5 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)