Skip to content

Commit

Permalink
epan: Fix get_display_repr crash on faked nodes
Browse files Browse the repository at this point in the history
If the node exists but does not have a field info, return an empty
string for the same reason as if the node is faked and doesn't exist.

Fixup 51e0dfa
(which allows faked nodes that exist but have null field info, in order
to preserve the tree shape.)

Fix #20224
  • Loading branch information
johnthacker committed Nov 16, 2024
1 parent 1a5f3fa commit f9be6d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion epan/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -7906,8 +7906,10 @@ proto_item_get_display_repr(wmem_allocator_t *scope, proto_item *pi)
field_info *fi;

if (!pi)
return "";
return wmem_strdup(scope, "");
fi = PITEM_FINFO(pi);
if (!fi)
return wmem_strdup(scope, "");
DISSECTOR_ASSERT(fi->hfinfo != NULL);
return fvalue_to_string_repr(scope, fi->value, FTREPR_DISPLAY, fi->hfinfo->display);
}
Expand Down

0 comments on commit f9be6d8

Please sign in to comment.