aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bvlc.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2005-05-23 05:52:28 +0000
committerAnders Broman <anders.broman@ericsson.com>2005-05-23 05:52:28 +0000
commit33aa290b25e317822fef3ce0ce60edd0df95bdc7 (patch)
treeee1831551393a7adaf50a6e7e8f8167b185a5ace /epan/dissectors/packet-bvlc.c
parentdbe55501fc1e8e98157921fb625b2b9ede6f6d4b (diff)
From Steve Karg:
* added additional value string enumerations from BACnet-2004 * removed vendor specific value string enumerations * corrected some value strings enumerations that were incorrect * refactored some common strings as strings + format * refactored some value strings to use a reserved range and a proprietary range by using val_to_split_str function which now correctly shows the split range when a value is not matched. * corrected some spelling errors * converted some item text values to dissector registration * added protocol tree for the BACnet tag headers * added value strings tree display for some bit string BACnet properties * added value strings tree display for some enumerated BACnet properties * changed the conversion of signed, unsigned, and enumerated BACnet values to use ntohx functions. * added proper handling for large values of signed, unsigned, and enumerated BACnet values. * refactored BACnet Null and Boolean Tag tree * refactored BACnet Real and Double Tag tree * changed comments into functions for special tags * changed some white space to match existing file style * refactored tvb_reported_length to tvb_length_remaining to simplify * corrected octet-string tree when length is zero * refactored octet-string tree to use tvb_bytes_to_str * corrected application tagged productions that were context tagged * corrected context tagged productions that were application tagged * corrected offset for BACnet character strings * refactored some identical service request tree handling * changed confirmed APDU to highlight the correct portion of the APDU * changed some dissector registration values to display as decimal * changed cast in call to iconv() to fix compiler warning * corrected bit-wise AND in AtomicFile tree handling packet-bvlc.c * added error text in tree when encoded length doesn't match actual length svn path=/trunk/; revision=14417
Diffstat (limited to 'epan/dissectors/packet-bvlc.c')
-rw-r--r--epan/dissectors/packet-bvlc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/epan/dissectors/packet-bvlc.c b/epan/dissectors/packet-bvlc.c
index db50ccf8ba..aa7820a588 100644
--- a/epan/dissectors/packet-bvlc.c
+++ b/epan/dissectors/packet-bvlc.c
@@ -107,6 +107,7 @@ dissect_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint16 bvlc_length;
guint16 packet_length;
guint npdu_length;
+ guint length_remaining;
guint16 bvlc_result;
tvbuff_t *next_tvb;
@@ -121,6 +122,7 @@ dissect_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
bvlc_type = tvb_get_guint8(tvb, offset);
bvlc_function = tvb_get_guint8(tvb, offset+1);
packet_length = tvb_get_ntohs(tvb, offset+2);
+ length_remaining = tvb_length_remaining(tvb, offset);
if (bvlc_function > 0x08) {
/* We have a constant header length of BVLC of 4 in every
* BVLC-packet forewarding an NPDU. Beware: Changes in the
@@ -159,9 +161,15 @@ dissect_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
bvlc_function, val_to_str (bvlc_function,
bvlc_function_names, "Unknown"));
offset ++;
- proto_tree_add_uint_format(bvlc_tree, hf_bvlc_length, tvb, offset,
- 2, bvlc_length, "BVLC-Length: %d of %d bytes BACnet packet length",
- bvlc_length, packet_length);
+ if (length_remaining != packet_length)
+ proto_tree_add_uint_format(bvlc_tree, hf_bvlc_length, tvb, offset,
+ 2, bvlc_length,
+ "BVLC-Length: %d of %d bytes (invalid length - expected %d bytes)",
+ bvlc_length, packet_length, length_remaining);
+ else
+ proto_tree_add_uint_format(bvlc_tree, hf_bvlc_length, tvb, offset,
+ 2, bvlc_length, "BVLC-Length: %d of %d bytes BACnet packet length",
+ bvlc_length, packet_length);
offset += 2;
switch (bvlc_function) {
case 0x00: /* BVLC-Result */