From ea2231458a55fd730398aa3570236490358f68a5 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 12 May 2017 11:40:04 +0200 Subject: gsm_osmux: Use proper sizes for structo smuxh fields Change-Id: I93de7ffdbd3c43494bc6a5dd1f44f6f45d6b54f8 --- epan/dissectors/packet-gsm_osmux.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/epan/dissectors/packet-gsm_osmux.c b/epan/dissectors/packet-gsm_osmux.c index 14a906603d..1aabe24c6d 100644 --- a/epan/dissectors/packet-gsm_osmux.c +++ b/epan/dissectors/packet-gsm_osmux.c @@ -150,21 +150,21 @@ struct osmux_stream { /* Tap structure of Osmux header */ struct osmux_hdr { - guint32 rtp_m; - guint32 ft; - guint32 ctr; - guint32 amr_f; - guint32 amr_q; - guint32 seq; - guint32 circuit_id; - guint32 amr_cmr; - guint32 amr_ft; + gboolean rtp_m; + guint8 ft; + guint8 ctr; + gboolean amr_f; + gboolean amr_q; + guint8 seq; + guint8 circuit_id; + guint8 amr_cmr; + guint8 amr_ft; gboolean is_old_dummy; struct osmux_stream *stream; }; static guint8 -amr_ft_to_bytes(guint32 amr_ft) +amr_ft_to_bytes(guint8 amr_ft) { if (amr_ft >= AMR_FT_MAX) /* malformed packet ? */ return 0; @@ -318,7 +318,7 @@ dissect_osmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U proto_tree *osmux_tree = NULL; guint8 ft_ctr; guint64 amr_ft_cmr; - guint i; + guint8 i; guint32 size; osmuxh = wmem_new0(wmem_packet_scope(), struct osmux_hdr); @@ -353,16 +353,19 @@ dissect_osmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U /* Old versions of the protocol used to send dummy packets of only 2 bytes (control + cid):_*/ if (ft_ctr == 0x23 && tvb_reported_length_remaining(tvb, offset - 1) == 2) { osmuxh->is_old_dummy = TRUE; - proto_tree_add_item_ret_uint(osmux_tree, hf_osmux_circuit_id, tvb, offset, 1, ENC_BIG_ENDIAN, &osmuxh->circuit_id); + osmuxh->circuit_id = tvb_get_guint8(tvb, offset); + proto_tree_add_item(osmux_tree, hf_osmux_circuit_id, tvb, offset, 1, ENC_BIG_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, "Old Dummy (CID %u)", osmuxh->circuit_id); finish_process_pkt(tvb, pinfo, tree, osmuxh); return tvb_reported_length(tvb); } - proto_tree_add_item_ret_uint(osmux_tree, hf_osmux_seq, tvb, offset, 1, ENC_BIG_ENDIAN, &osmuxh->seq); + osmuxh->seq = tvb_get_guint8(tvb, offset); + proto_tree_add_item(osmux_tree, hf_osmux_seq, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - proto_tree_add_item_ret_uint(osmux_tree, hf_osmux_circuit_id, tvb, offset, 1, ENC_BIG_ENDIAN, &osmuxh->circuit_id); + osmuxh->circuit_id = tvb_get_guint8(tvb, offset); + proto_tree_add_item(osmux_tree, hf_osmux_circuit_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; col_append_fstr(pinfo->cinfo, COL_INFO, "(CID %u) ", osmuxh->circuit_id); -- cgit v1.2.3