X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl_json.c;h=a547ddcd42a53ac9198475cb78387aed95f87c7b;hb=ba52f94929822b1968f05cfbb37985af2e0b83a4;hp=4188f37862bf7f639e9bfa01fddf419245b28b31;hpb=276d1e1bdfc3e02431bb05c06da7a16f80fa7e47;p=collectd.git diff --git a/src/curl_json.c b/src/curl_json.c index 4188f378..a547ddcd 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -143,6 +143,9 @@ static int cj_get_type (cj_key_t *key) { const data_set_t *ds; + if ((key == NULL) || !CJ_IS_KEY (key)) + return -EINVAL; + ds = plugin_get_ds (key->type); if (ds == NULL) { @@ -226,12 +229,15 @@ static int cj_cb_number (void *ctx, buffer[sizeof (buffer) - 1] = 0; if ((key == NULL) || !CJ_IS_KEY (key)) { - if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/) + if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/) { NOTICE ("curl_json plugin: Found \"%s\", but the configuration expects" " a map.", buffer); + return (CJ_CB_CONTINUE); + } + cj_cb_inc_array_index (ctx, /* update_key = */ 1); key = db->state[db->depth].key; - if (key == NULL) { + if ((key == NULL) || !CJ_IS_KEY (key)) { return (CJ_CB_CONTINUE); } }