aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2007-04-18 07:06:56 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2007-04-18 07:06:56 +0000
commitee73a2aff27641ad7a1e949cf8526fed020172f9 (patch)
treeda65b44d710fa02f7c64b2e9fbf4c71274528c82 /epan
parent5e859c36d7425337e380ca0a88bd062f4d898555 (diff)
Don't use DISSECTOR_ASSERT to (essentially) verify packet data. Instead
add an expert info entry if the AVP length is 0 and just return after dissecting that AVP. svn path=/trunk/; revision=21465
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-pana.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/epan/dissectors/packet-pana.c b/epan/dissectors/packet-pana.c
index f5731f361b..0d2bf00896 100644
--- a/epan/dissectors/packet-pana.c
+++ b/epan/dissectors/packet-pana.c
@@ -42,6 +42,7 @@
#include <epan/value_string.h>
#include <epan/conversation.h>
#include <epan/emem.h>
+#include <epan/expert.h>
#define PANA_UDP_PORT 3001
#define PANA_VERSION 1
@@ -393,6 +394,8 @@ dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
single_avp_tree = proto_item_add_subtree(single_avp_item, ett_pana_avp_info);
if (single_avp_tree != NULL) {
+ proto_item *pi;
+
/* AVP Code */
proto_tree_add_uint_format_value(single_avp_tree, hf_pana_avp_code, tvb,
offset, 2, avp_code, "%s (%u)",
@@ -402,12 +405,17 @@ dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
/* AVP Flags */
dissect_pana_avp_flags(single_avp_tree, tvb, offset, avp_flags);
offset += 2;
+
/* AVP Length */
- proto_tree_add_item(single_avp_tree, hf_pana_avp_length, tvb, offset, 2, FALSE);
+ pi = proto_tree_add_item(single_avp_tree, hf_pana_avp_length, tvb, offset, 2, FALSE);
+ if (avp_length == 0)
+ expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "AVP with length 0");
offset += 2;
+
/* Reserved */
proto_tree_add_item(single_avp_tree, hf_pana_avp_reserved, tvb, offset, 2, FALSE);
offset += 2;
+
/* Vendor ID */
if (avp_flags & PANA_AVP_FLAG_V) {
proto_tree_add_item(single_avp_tree, hf_pana_avp_vendorid, tvb, offset, 4, FALSE);
@@ -487,8 +495,10 @@ dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
break;
}
}
+
/* Just check that offset will advance */
- DISSECTOR_ASSERT((avp_length+padding)!=0);
+ if ((avp_length+padding)!=0)
+ return;
offset += avp_data_length + padding;
}