print: don't ignore FT_NONE fields in ek.

The 'null' placeholder has been used in such a fields. Otherwise
the json dumper would complain for the lack of a value, getting
confused by a double name add without values.

Bug: 15628
Change-Id: I016325790f8d4a02ed9288225e861ba2d23a82f9
Reviewed-on: https://code.wireshark.org/review/32532
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Dario Lombardo 2019-03-22 22:56:48 +01:00 committed by Peter Wu
parent ed40d31801
commit 5a98368ad8
1 changed files with 8 additions and 3 deletions

View File

@ -1278,7 +1278,8 @@ ek_write_field_value(field_info *fi, write_json_data* pdata)
}
else {
/* show, value, and unmaskedvalue attributes */
if (fi->hfinfo->type == FT_PROTOCOL) {
switch(fi->hfinfo->type) {
case FT_PROTOCOL:
if (fi->rep) {
json_dumper_value_string(pdata->dumper, fi->rep->representation);
}
@ -1286,13 +1287,17 @@ ek_write_field_value(field_info *fi, write_json_data* pdata)
proto_item_fill_label(fi, label_str);
json_dumper_value_string(pdata->dumper, label_str);
}
}
else if (fi->hfinfo->type != FT_NONE) {
break;
case FT_NONE:
json_dumper_value_string(pdata->dumper, NULL);
break;
default:
dfilter_string = fvalue_to_string_repr(NULL, &fi->value, FTREPR_DISPLAY, fi->hfinfo->display);
if (dfilter_string != NULL) {
json_dumper_value_string(pdata->dumper, dfilter_string);
}
wmem_free(NULL, dfilter_string);
break;
}
}
}