diff options
author | Pavel Levshin <pavel@levshin.spb.ru> | 2013-10-24 16:03:18 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-24 16:03:18 +0200 |
commit | 053576d9f1c194a071187f9b87641d7da73e5a72 (patch) | |
tree | 7d2c0c2adde80564f42017c4b67a25e4d9d7fd3a | |
parent | 599572684b94f16eb8254f4c7c89ca735b270193 (diff) | |
download | rsyslog-053576d9f1c194a071187f9b87641d7da73e5a72.tar.gz rsyslog-053576d9f1c194a071187f9b87641d7da73e5a72.tar.bz2 rsyslog-053576d9f1c194a071187f9b87641d7da73e5a72.zip |
bugfix: Segmentation fault on incorrect variable assignment
-rw-r--r-- | runtime/msg.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index e159bba9..e30ff671 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -4030,6 +4030,12 @@ msgAddJSONObj(msg_t *pM, uchar *name, struct json_object *json, struct json_obje } leaf = jsonPathGetLeaf(name, ustrlen(name)); CHKiRet(jsonPathFindParent(*pjroot, name, leaf, &parent, 1)); + if (json_object_get_type(parent) != json_type_object) { + DBGPRINTF("msgAddJSON: not a container in json path," + "name is '%s'\n", name); + json_object_put(json); + ABORT_FINALIZE(RS_RET_INVLD_SETOP); + } leafnode = json_object_object_get(parent, (char*)leaf); if(leafnode == NULL) { json_object_object_add(parent, (char*)leaf, json); |