diff options
author | Uli Heilmeier <uh@heilmeier.eu> | 2022-08-06 22:14:32 +0200 |
---|---|---|
committer | A Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2022-08-06 20:42:15 +0000 |
commit | f9cf0a0ae7ebd8c4dd1da15c1ca4296313242a9a (patch) | |
tree | 4b13cde240228a1e840026eaa6dd466f3f83ec7e /epan | |
parent | da5603a0d0f35409306eaf35446d508c75aa6120 (diff) |
BGP: Check nhlen
Only call tvb_bytes_to_str() when nhlen > 0
Fixes: #18248
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-bgp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index bfccdc0e20..0ffa7e8e5d 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -4507,7 +4507,9 @@ decode_mp_next_hop(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint16 proto_item_append_text(ti, ": %s", wmem_strbuf_get_str(strbuf)); } else { expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid, "Unknown Next Hop length (%u byte%s)", nhlen, plurality(nhlen, "", "s")); - proto_item_append_text(ti, ": %s", tvb_bytes_to_str(pinfo->pool, tvb, offset, nhlen)); + if (nhlen > 0) { + proto_item_append_text(ti, ": %s", tvb_bytes_to_str(pinfo->pool, tvb, offset, nhlen)); + } } return length; |