diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-01-24 19:25:29 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-01-24 22:20:13 +0000 |
commit | e85c8bed87821e75965fca093294c23d12ac4b21 (patch) | |
tree | adf0690a902928b79e18229c8dc1d920d5ce06da /epan/print.c | |
parent | d3f1e2fa19d0aa049658dac244fb78a1dc892743 (diff) |
tshark: fix crash with -Tjson and -e field
Fix the assertion to check for the actual requirements. Add tests for -T
combined with -e.
Bug: 15444
Change-Id: I83e7663572db0c60194f6d6128b9e1ae7396b3f6
Fixes: v2.9.1rc0-226-g30c90fa745 ("epan: use json_dumper for json outputs.")
Reviewed-on: https://code.wireshark.org/review/31724
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/print.c')
-rw-r--r-- | epan/print.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/epan/print.c b/epan/print.c index fd0a8221ee..7611c917c1 100644 --- a/epan/print.c +++ b/epan/print.c @@ -390,7 +390,7 @@ write_ek_proto_tree(output_fields_t* fields, proto_tree_write_node_ek(edt->tree, &data); } else { /* Write out specified fields */ - write_specified_fields(FORMAT_EK, fields, edt, cinfo, fh, data.dumper); + write_specified_fields(FORMAT_EK, fields, edt, cinfo, NULL, data.dumper); } json_dumper_end_object(&dumper); @@ -2339,7 +2339,12 @@ static void write_specified_fields(fields_format format, output_fields_t *fields g_assert(fields); g_assert(fields->fields); g_assert(edt); - g_assert(fh); + /* JSON formats must go through json_dumper */ + if (format == FORMAT_JSON || format == FORMAT_EK) { + g_assert(!fh && dumper); + } else { + g_assert(fh && !dumper); + } data.fields = fields; data.edt = edt; |