From 8ad56117502207d95d54bd2c8dff24d001530d24 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Wed, 26 Aug 2015 22:52:06 +0200 Subject: sv: remove some unnecessary checks http://personal.strath.ac.uk/robert.c.atkinson/papers/sgms2011.pdf implies that appid, length and the two reserved fields are mandatory just try to dissect them, don't check if there's enough bytes remaining correct a typo while at it Change-Id: I09a315fc2c70161af527dca5661f877e09b63ff6 Reviewed-on: https://code.wireshark.org/review/10273 Reviewed-by: Martin Kaiser --- asn1/sv/packet-sv-template.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'asn1') diff --git a/asn1/sv/packet-sv-template.c b/asn1/sv/packet-sv-template.c index 3a13b50aef..5403d02df9 100644 --- a/asn1/sv/packet-sv-template.c +++ b/asn1/sv/packet-sv-template.c @@ -1,5 +1,5 @@ /* packet-sv.c - * Routines for IEC 61850 Sampled Vales packet dissection + * Routines for IEC 61850 Sampled Values packet dissection * Michael Bernhard 2008 * * Wireshark - Network traffic analyzer @@ -113,23 +113,19 @@ dissect_sv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) col_clear(pinfo->cinfo, COL_INFO); /* APPID */ - if (tree && tvb_reported_length_remaining(tvb, offset) >= 2) - proto_tree_add_item(tree, hf_sv_appid, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_sv_appid, tvb, offset, 2, ENC_BIG_ENDIAN); /* Length */ - if (tree && tvb_reported_length_remaining(tvb, offset) >= 4) - proto_tree_add_item(tree, hf_sv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_sv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); /* Reserved 1 */ - if (tree && tvb_reported_length_remaining(tvb, offset) >= 6) - proto_tree_add_item(tree, hf_sv_reserve1, tvb, offset + 4, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_sv_reserve1, tvb, offset + 4, 2, ENC_BIG_ENDIAN); /* Reserved 2 */ - if (tree && tvb_reported_length_remaining(tvb, offset) >= 8) - proto_tree_add_item(tree, hf_sv_reserve2, tvb, offset + 6, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_sv_reserve2, tvb, offset + 6, 2, ENC_BIG_ENDIAN); offset = 8; - while (tree && tvb_reported_length_remaining(tvb, offset) > 0){ + while (tvb_reported_length_remaining(tvb, offset) > 0){ old_offset = offset; offset = dissect_sv_SampledValues(FALSE, tvb, offset, &asn1_ctx , tree, -1); if (offset == old_offset) { -- cgit v1.2.3