forked from osmocom/wireshark
Fix segfault in Elasticsearch output
When using the Elasticsearch output but only printing the packet summary with -P a segfault will occur because the empty packet tree is not properly handled in this case. Change-Id: I0c91314ae013785ae6dceabd6af33db4b836d1b2 Reviewed-on: https://code.wireshark.org/review/24153 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
3a1f958cf8
commit
6d8661ceef
32
epan/print.c
32
epan/print.c
|
@ -380,24 +380,28 @@ write_ek_proto_tree(output_fields_t* fields,
|
|||
if (print_summary)
|
||||
write_ek_summary(edt->pi.cinfo, fh);
|
||||
|
||||
fprintf(fh, ", \"layers\" : {");
|
||||
if (edt->tree) {
|
||||
fprintf(fh, ", \"layers\" : {");
|
||||
|
||||
if (fields == NULL || fields->fields == NULL) {
|
||||
/* Write out all fields */
|
||||
data.level = 0;
|
||||
data.fh = fh;
|
||||
data.src_list = edt->pi.data_src;
|
||||
data.filter = protocolfilter;
|
||||
data.filter_flags = protocolfilter_flags;
|
||||
data.print_hex = print_hex;
|
||||
if (fields == NULL || fields->fields == NULL) {
|
||||
/* Write out all fields */
|
||||
data.level = 0;
|
||||
data.fh = fh;
|
||||
data.src_list = edt->pi.data_src;
|
||||
data.filter = protocolfilter;
|
||||
data.filter_flags = protocolfilter_flags;
|
||||
data.print_hex = print_hex;
|
||||
|
||||
proto_tree_write_node_ek(edt->tree, &data);
|
||||
} else {
|
||||
/* Write out specified fields */
|
||||
write_specified_fields(FORMAT_EK, fields, edt, NULL, fh);
|
||||
proto_tree_write_node_ek(edt->tree, &data);
|
||||
} else {
|
||||
/* Write out specified fields */
|
||||
write_specified_fields(FORMAT_EK, fields, edt, NULL, fh);
|
||||
}
|
||||
|
||||
fputs("}", fh);
|
||||
}
|
||||
|
||||
fputs("}}\n", fh);
|
||||
fputs("}\n", fh);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue