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:
Christoph Wurm 2017-10-29 01:33:46 +00:00 committed by Michael Mann
parent 3a1f958cf8
commit 6d8661ceef
1 changed files with 18 additions and 14 deletions

View File

@ -380,6 +380,7 @@ write_ek_proto_tree(output_fields_t* fields,
if (print_summary)
write_ek_summary(edt->pi.cinfo, fh);
if (edt->tree) {
fprintf(fh, ", \"layers\" : {");
if (fields == NULL || fields->fields == NULL) {
@ -397,7 +398,10 @@ write_ek_proto_tree(output_fields_t* fields,
write_specified_fields(FORMAT_EK, fields, edt, NULL, fh);
}
fputs("}}\n", fh);
fputs("}", fh);
}
fputs("}\n", fh);
}
void