From 292193bff197190597872025f3d333860a9abc04 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 10 Jun 2019 08:31:28 +0200 Subject: [PATCH] batadv: Fix info column seqno of IV_OGM v15 packets The sequence number shown in the info field is read from the iv_ogm_packet_v15 object before the actual member is actual read from the packet buffer. Just split the initialization of the info column to the actual dissection code for the packet to avoid these kind of problems. Change-Id: I8eb637aae17680d227116156ef7828e77e36beae Fixes: 4cc431579363 ("batadv: Add dissector support for batadv v15") Signed-off-by: Sven Eckelmann Reviewed-on: https://code.wireshark.org/review/33547 Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin --- epan/dissectors/packet-batadv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/epan/dissectors/packet-batadv.c b/epan/dissectors/packet-batadv.c index d2c941d9c8..209883a653 100644 --- a/epan/dissectors/packet-batadv.c +++ b/epan/dissectors/packet-batadv.c @@ -1714,7 +1714,7 @@ static int dissect_batadv_iv_ogm_v15(tvbuff_t *tvb, int offset, sizeof(struct iv_ogm_packet_v15)); /* Set info column */ - col_add_fstr(pinfo->cinfo, COL_INFO, "Seq=%u", iv_ogm_packeth->seqno); + col_clear(pinfo->cinfo, COL_INFO); /* Set tree info */ ti = proto_tree_add_protocol_format(tree, proto_batadv_plugin, @@ -1749,9 +1749,10 @@ static int dissect_batadv_iv_ogm_v15(tvbuff_t *tvb, int offset, flags, ENC_NA); offset += 1; - iv_ogm_packeth->seqno = tvb_get_ntohl(tvb, offset); - proto_tree_add_item(batadv_iv_ogm_tree, hf_batadv_iv_ogm_seqno, tvb, - offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item_ret_uint(batadv_iv_ogm_tree, hf_batadv_iv_ogm_seqno, + tvb, offset, 4, ENC_BIG_ENDIAN, + &iv_ogm_packeth->seqno); + col_add_fstr(pinfo->cinfo, COL_INFO, "Seq=%u", iv_ogm_packeth->seqno); offset += 4; set_address_tvb(&iv_ogm_packeth->orig, AT_ETHER, 6, tvb, offset);