aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2009-08-09 01:23:09 +0000
committerGuy Harris <guy@alum.mit.edu>2009-08-09 01:23:09 +0000
commitfc067ab9104d12f3683c8f112250b8523260b77f (patch)
tree1a01a83d827491c41593768815436d771012fed1 /epan
parent53a24d94f9a8531f937a840c2e993cf4fe42f326 (diff)
Don't use DISSECTOR_ASSERT() to check a packet's content. Fixes bug
3827. svn path=/trunk/; revision=29339
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-ppp.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index 76a704d108..7c7420cf2f 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -3275,8 +3275,6 @@ dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ip_version = tvb_get_guint8(tvb, 0) >> 4;
next_protocol = tvb_get_guint8(tvb, 9);
- DISSECTOR_ASSERT((ip_version == 4) && (next_protocol == IP_PROTO_UDP));
-
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_iphc_crtp, tvb, 0, -1,
@@ -3285,17 +3283,31 @@ dissect_iphc_crtp_fh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
flags = (tvb_get_guint8(tvb, 2) & IPHC_CRTP_FH_FLAG_MASK) >> IPHC_CRTP_FH_FLAG_POS;
+ /* flags field */
+ ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_fh_flags, tvb, 2, 1, FALSE);
+
+ /* generation field */
+ ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_gen, tvb, 2, 1, FALSE);
+
/* calculate length of IP header, assume IPv4 */
ip_hdr_len = (tvb_get_guint8(tvb, 0) & 0x0f) * 4;
/* calculate total hdr length, assume UDP */
hdr_len = ip_hdr_len + 8;
- /* flags field */
- ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_fh_flags, tvb, 2, 1, FALSE);
+ if (ip_version != 4) {
+ proto_tree_add_text(fh_tree, tvb, 3, -1,
+ "IP version is %u: the only supported version is 4",
+ ip_version);
+ return;
+ }
- /* generation field */
- ti = proto_tree_add_item(fh_tree, hf_iphc_crtp_gen, tvb, 2, 1, FALSE);
+ if (next_protocol != IP_PROTO_UDP) {
+ proto_tree_add_text(fh_tree, tvb, 3, -1,
+ "Next protocol is %s (%u): the only supported protocol is UDP",
+ ipprotostr(next_protocol), next_protocol);
+ return;
+ }
/* context id and sequence fields */
switch (flags) {