From 8e256b7e694d6d39f93d41a788835e85855780eb Mon Sep 17 00:00:00 2001 From: Thomas Dreibholz Date: Sat, 26 Jun 2021 13:32:22 +0200 Subject: [PATCH] Bugfix for S101 dissector: Make sure that the packet has an S101 header, before setting the protocol name with col_set_str(). Otherwise, all TCP packets on port 9000 may be misidentified as S101 packets. --- epan/dissectors/packet-s101.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/epan/dissectors/packet-s101.c b/epan/dissectors/packet-s101.c index 9b91cb694e..0ae1e3378c 100644 --- a/epan/dissectors/packet-s101.c +++ b/epan/dissectors/packet-s101.c @@ -360,9 +360,6 @@ dissect_S101(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (len < S101_MIN_LENGTH) return 0; - /* Set the Protocol column to the constant string of S101 */ - col_set_str(pinfo->cinfo, COL_PROTOCOL, "S101"); - current_offset = 0; do { offset = current_offset; @@ -370,6 +367,10 @@ dissect_S101(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (0 == find_s101_packet_header(tvb, &offset, &start, &slot, &message, &version, &dtd, &command, &flags, &app_bytes[0], &msgLength, &crc)) { break; } + if (0 == current_offset) { + /* Set the Protocol column to the constant string of S101 */ + col_set_str(pinfo->cinfo, COL_PROTOCOL, "S101"); + } /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_S101, tvb, current_offset, -1, ENC_NA);