diff options
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; } } |