summaryrefslogtreecommitdiffstats
path: root/runtime/msg.c
diff options
context:
space:
mode:
authorPavel Levshin <pavel@levshin.spb.ru>2013-10-24 16:21:33 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2013-10-24 16:21:33 +0200
commit5bf1afd637326a8a88ca6a511d0fbd922d5e815c (patch)
treef92b3c668031cfa945135749713e20d8de6f5985 /runtime/msg.c
parenta781f8b8b0eee6379880822933b9966ffed5492f (diff)
downloadrsyslog-5bf1afd637326a8a88ca6a511d0fbd922d5e815c.tar.gz
rsyslog-5bf1afd637326a8a88ca6a511d0fbd922d5e815c.tar.bz2
rsyslog-5bf1afd637326a8a88ca6a511d0fbd922d5e815c.zip
bugfix: Segmentation fault on incorrect variable assignment
Diffstat (limited to 'runtime/msg.c')
-rw-r--r--runtime/msg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 03906070..10ecf48a 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -3934,6 +3934,12 @@ msgAddJSON(msg_t *pM, uchar *name, struct json_object *json)
}
leaf = jsonPathGetLeaf(name, ustrlen(name));
CHKiRet(jsonPathFindParent(pM, 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);