diff options
-rw-r--r-- | epan/dissectors/packet-ieee1722.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-zbee-zcl.c | 6 | ||||
-rw-r--r-- | epan/tvbuff.c | 1 |
3 files changed, 7 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c index ed3a3dabfb..70d0bacb47 100644 --- a/epan/dissectors/packet-ieee1722.c +++ b/epan/dissectors/packet-ieee1722.c @@ -2622,7 +2622,8 @@ static int dissect_1722_acf_can_common(tvbuff_t *tvb, packet_info *pinfo, proto_ parsed.datalen = (guint)payload_length; proto_tree_add_uint(tree_acf_can, hf_1722_can_len, tvb, offset, 1, parsed.datalen); - col_append_str(pinfo->cinfo, COL_INFO, tvb_bytes_to_str_punct(pinfo->pool, tvb, offset, payload_length, ' ')); + if (payload_length > 0) + col_append_str(pinfo->cinfo, COL_INFO, tvb_bytes_to_str_punct(pinfo->pool, tvb, offset, payload_length, ' ')); if (parsed.is_fd && !is_valid_canfd_payload_length(payload_length)) { diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c index eac60bedc3..0c930e9750 100644 --- a/epan/dissectors/packet-zbee-zcl.c +++ b/epan/dissectors/packet-zbee-zcl.c @@ -2053,7 +2053,8 @@ void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint case ZBEE_ZCL_OCTET_STRING: /* Display octet string */ proto_tree_add_item_ret_length(tree, hf_zbee_zcl_attr_ostr, tvb, *offset, 1, ENC_NA|ENC_ZIGBEE, &attr_int); - proto_item_append_text(tree, ", Octets: %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, (*offset)+1, attr_int-1, ':')); + if (attr_int > 1) + proto_item_append_text(tree, ", Octets: %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, (*offset)+1, attr_int-1, ':')); *offset += attr_int; break; @@ -2067,7 +2068,8 @@ void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint case ZBEE_ZCL_LONG_OCTET_STRING: /* Display long octet string */ proto_tree_add_item_ret_length(tree, hf_zbee_zcl_attr_ostr, tvb, *offset, 2, ENC_LITTLE_ENDIAN|ENC_ZIGBEE, &attr_int); - proto_item_append_text(tree, ", Octets: %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, (*offset)+2, attr_int-2, ':')); + if (attr_int > 2) + proto_item_append_text(tree, ", Octets: %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, (*offset)+2, attr_int-2, ':')); *offset += attr_int; break; diff --git a/epan/tvbuff.c b/epan/tvbuff.c index bcf8a183ca..5dab307577 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -4318,6 +4318,7 @@ int tvb_get_token_len(tvbuff_t *tvb, const gint offset, int len, gint *next_offs gchar * tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint len, const gchar punct) { + DISSECTOR_ASSERT(len > 0); return bytes_to_str_punct(scope, ensure_contiguous(tvb, offset, len), len, punct); } |