Skip to content

Commit 2be1b44

Browse files
authored
out_splunk: Fix crashes when passed non-array input data (#2457)
At present, non-array inputs cause a segfault when trying to read key-value pairs out of an assumed-to-be-there map. Other output plugins already make a check of this form, including es, gelf, influxdb, kube_meta, td, and syslog -- but splunk currently does not. This patch simply adds one. Signed-off-by: Aaron Jacobs <[email protected]>
1 parent e8f1d81 commit 2be1b44

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

plugins/out_splunk/splunk.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ static int splunk_format(const void *in_buf, size_t in_bytes,
7474
msgpack_unpacked_init(&result);
7575

7676
while (msgpack_unpack_next(&result, in_buf, in_bytes, &off) == MSGPACK_UNPACK_SUCCESS) {
77+
if (result.data.type != MSGPACK_OBJECT_ARRAY) {
78+
continue;
79+
}
80+
7781
root = result.data;
82+
if (root.via.array.size != 2) {
83+
continue;
84+
}
7885

7986
/* Get timestamp */
8087
flb_time_pop_from_msgpack(&tm, &result, &obj);

0 commit comments

Comments
 (0)