diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2018-06-15 10:34:24 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2018-06-15 09:43:43 +0000 |
commit | 25d3c6270ad11fc09d23354774de9a1e42000137 (patch) | |
tree | 32c2d2a34741fef3bac457e27c587d953d3ab6d8 /epan/dissectors/packet-mac-nr.c | |
parent | 5ea2fe384434db598cb0ed62987627a8cfd76a56 (diff) |
MAC NR: fix dissection of single byte padding CE
Change-Id: Icff0ffb4600bd778946ca879995edf710cc38e48
Reviewed-on: https://code.wireshark.org/review/28284
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-mac-nr.c')
-rw-r--r-- | epan/dissectors/packet-mac-nr.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/epan/dissectors/packet-mac-nr.c b/epan/dissectors/packet-mac-nr.c index 822cd290e3..10b3784000 100644 --- a/epan/dissectors/packet-mac-nr.c +++ b/epan/dissectors/packet-mac-nr.c @@ -1358,12 +1358,15 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree } break; case PADDING_LCID: - /* The rest of the PDU is padding */ - proto_tree_add_item(subheader_tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA); - write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(Padding %u bytes) ", - tvb_reported_length_remaining(tvb, offset)); - /* Move to the end of the frame */ - offset = tvb_captured_length(tvb); + { + /* The rest of the PDU is padding */ + int pad_len = tvb_reported_length_remaining(tvb, offset); + if (pad_len > 0) + proto_tree_add_item(subheader_tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA); + write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(Padding %u bytes) ", pad_len); + /* Move to the end of the frame */ + offset = tvb_reported_length(tvb); + } break; } } @@ -1720,11 +1723,15 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo, "(Contention Resolution) "); break; case PADDING_LCID: - write_pdu_label_and_info_literal(pdu_ti, subheader_ti, pinfo, "(Padding) "); - - /* The rest of the PDU is padding */ - proto_tree_add_item(subheader_tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA); - offset = tvb_captured_length(tvb); + { + /* The rest of the PDU is padding */ + int pad_len = tvb_reported_length_remaining(tvb, offset); + if (pad_len > 0) + proto_tree_add_item(subheader_tree, hf_mac_nr_padding, tvb, offset, -1, ENC_NA); + write_pdu_label_and_info(pdu_ti, subheader_ti, pinfo, "(Padding %u bytes) ", pad_len); + /* Move to the end of the frame */ + offset = tvb_reported_length(tvb); + } break; } } |