diff options
author | Michael Tüxen <tuexen@wireshark.org> | 2014-11-19 15:35:36 +0100 |
---|---|---|
committer | Michael Tüxen <tuexen@wireshark.org> | 2014-11-19 14:38:30 +0000 |
commit | d7179ac0ff24b61515897b9d0efbca1ed3f5ee4e (patch) | |
tree | c37c42ddd22b9877befa35267153b703b719e439 | |
parent | c62dac1a7743750a92871ba4c84eccda473b7c32 (diff) |
Fix the length reported as value length.
The length reported as value length for unknown chunks
was actually the chunk length. Therefore it was off by 4.
Change-Id: Ieea79d2c51b4729fc139395174625d1f362d1ee5
Reviewed-on: https://code.wireshark.org/review/5392
Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
-rw-r--r-- | epan/dissectors/packet-sctp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c index 333d706c7e..2b5592b46e 100644 --- a/epan/dissectors/packet-sctp.c +++ b/epan/dissectors/packet-sctp.c @@ -4138,10 +4138,13 @@ dissect_pktdrop_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pi static void dissect_unknown_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, guint8 chunk_type, proto_tree *chunk_tree, proto_item *chunk_item) { + guint16 value_length; + if (chunk_tree) { - if (chunk_length > CHUNK_HEADER_LENGTH) - proto_tree_add_item(chunk_tree, hf_chunk_value, chunk_tvb, CHUNK_VALUE_OFFSET, chunk_length - CHUNK_HEADER_LENGTH, ENC_NA); - proto_item_append_text(chunk_item, " (Type: %u, value length: %u byte%s)", chunk_type, chunk_length, plurality(chunk_length - CHUNK_HEADER_LENGTH, "", "s")); + value_length = chunk_length - CHUNK_HEADER_LENGTH; + if (value_length > 0) + proto_tree_add_item(chunk_tree, hf_chunk_value, chunk_tvb, CHUNK_VALUE_OFFSET, value_length, ENC_NA); + proto_item_append_text(chunk_item, " (Type: %u, value length: %u byte%s)", chunk_type, value_length, plurality(value_length, "", "s")); } } |