aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-01-16 16:06:15 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-01-16 16:06:15 +0000
commit1c9781b4ec6e907548bf144f04bd2de850c38b76 (patch)
treed5c476ab5cc45bb308d2bf464913b3d7805504c2 /epan/dissectors
parent491ceb39058e9038aba4f35bae505f1af031a120 (diff)
throw the new FieldError exception, if a dissector tries to add a field with invalid parameters
add a message parameter to the show_exception function svn path=/trunk/; revision=13074
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-acse.c2
-rw-r--r--epan/dissectors/packet-dcerpc.c6
-rw-r--r--epan/dissectors/packet-ethertype.c2
-rw-r--r--epan/dissectors/packet-frame.c16
-rw-r--r--epan/dissectors/packet-frame.h2
-rw-r--r--epan/dissectors/packet-ieee8023.c2
-rw-r--r--epan/dissectors/packet-isl.c2
-rw-r--r--epan/dissectors/packet-pres.c2
-rw-r--r--epan/dissectors/packet-ses.c2
9 files changed, 24 insertions, 12 deletions
diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c
index da96e6c636..1ba1eb52ea 100644
--- a/epan/dissectors/packet-acse.c
+++ b/epan/dissectors/packet-acse.c
@@ -228,7 +228,7 @@ call_app_dissector(tvbuff_t *tvb, gint offset, gint param_len,
}
CATCH_ALL
{
- show_exception(tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
}
ENDTRY;
}
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index 33860a8c58..8f378322eb 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -2108,7 +2108,7 @@ else
} CATCH(BoundsError) {
RETHROW;
} CATCH_ALL {
- show_exception(decrypted_tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(decrypted_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
} ENDTRY;
}
@@ -2168,7 +2168,7 @@ dissect_dcerpc_verifier (tvbuff_t *tvb, packet_info *pinfo,
dissect_auth_verf(auth_tvb, pinfo, dcerpc_tree, auth_fns,
hdr, auth_info);
} CATCH_ALL {
- show_exception(auth_tvb, pinfo, dcerpc_tree, EXCEPT_CODE);
+ show_exception(auth_tvb, pinfo, dcerpc_tree, EXCEPT_CODE, GET_MESSAGE);
} ENDTRY;
} else {
proto_tree_add_text (dcerpc_tree, auth_tvb, 0, hdr->auth_len,
@@ -2269,7 +2269,7 @@ dissect_dcerpc_cn_auth (tvbuff_t *tvb, int stub_offset, packet_info *pinfo,
padding is actually inside the encrypted stub */
auth_info->auth_size = hdr->auth_len + 8;
} CATCH_ALL {
- show_exception(tvb, pinfo, dcerpc_tree, EXCEPT_CODE);
+ show_exception(tvb, pinfo, dcerpc_tree, EXCEPT_CODE, GET_MESSAGE);
} ENDTRY;
}
}
diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c
index 93933100be..60a058c3c0 100644
--- a/epan/dissectors/packet-ethertype.c
+++ b/epan/dissectors/packet-ethertype.c
@@ -208,7 +208,7 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
to show the trailer, after noting that a dissector was
found and restoring the protocol value that was in effect
before we called the subdissector. */
- show_exception(next_tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
dissector_found = TRUE;
pinfo->current_proto = saved_proto;
}
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index 29efbc76c5..0716595f72 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -194,7 +194,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
CATCH_ALL {
- show_exception(tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
}
ENDTRY;
@@ -206,7 +206,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
void
show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- unsigned long exception)
+ unsigned long exception, const char *exception_message)
{
switch (exception) {
@@ -220,6 +220,18 @@ show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case ReportedBoundsError:
show_reported_bounds_error(tvb, pinfo, tree);
break;
+ case FieldError:
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_append_str(pinfo->cinfo, COL_INFO, "[Dissector Bug]");
+ proto_tree_add_protocol_format(tree, proto_malformed, tvb, 0, 0,
+ "[FieldError: %s]", exception_message);
+ g_warning("FieldError in packet: %u (%s)", pinfo->fd->num, exception_message);
+ if(exception_message)
+ g_free( (void *) exception_message);
+ break;
+ default:
+ /* XXX - we want to know, if an unknown exception passed until here, don't we? */
+ g_assert_not_reached();
}
}
diff --git a/epan/dissectors/packet-frame.h b/epan/dissectors/packet-frame.h
index f5a135956b..1430fb1544 100644
--- a/epan/dissectors/packet-frame.h
+++ b/epan/dissectors/packet-frame.h
@@ -27,7 +27,7 @@
* Routine used to add an indication of an arbitrary exception to the tree.
*/
void show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- unsigned long exception);
+ unsigned long exception, const char *exception_message);
/*
* Routine used to add an indication of a ReportedBoundsError exception
diff --git a/epan/dissectors/packet-ieee8023.c b/epan/dissectors/packet-ieee8023.c
index 5e8f98aa2d..55853d9d15 100644
--- a/epan/dissectors/packet-ieee8023.c
+++ b/epan/dissectors/packet-ieee8023.c
@@ -102,7 +102,7 @@ dissect_802_3(int length, gboolean is_802_2, tvbuff_t *tvb,
Show the exception, and then drive on to show the trailer,
restoring the protocol value that was in effect before we
called the subdissector. */
- show_exception(next_tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
pinfo->current_proto = saved_proto;
}
ENDTRY;
diff --git a/epan/dissectors/packet-isl.c b/epan/dissectors/packet-isl.c
index c1544dc611..44e099de55 100644
--- a/epan/dissectors/packet-isl.c
+++ b/epan/dissectors/packet-isl.c
@@ -287,7 +287,7 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int fcs_len)
Show the exception, and then drive on to show the trailer,
restoring the protocol value that was in effect before we
called the subdissector. */
- show_exception(next_tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
pinfo->current_proto = saved_proto;
}
ENDTRY;
diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c
index d12218316e..b692101ae7 100644
--- a/epan/dissectors/packet-pres.c
+++ b/epan/dissectors/packet-pres.c
@@ -242,7 +242,7 @@ call_acse_dissector(tvbuff_t *tvb, gint offset, gint param_len,
}
CATCH_ALL
{
- show_exception(tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
}
ENDTRY;
}
diff --git a/epan/dissectors/packet-ses.c b/epan/dissectors/packet-ses.c
index b7e792769a..fe34919adf 100644
--- a/epan/dissectors/packet-ses.c
+++ b/epan/dissectors/packet-ses.c
@@ -298,7 +298,7 @@ call_pres_dissector(tvbuff_t *tvb, int offset, guint16 param_len,
}
CATCH_ALL
{
- show_exception(tvb, pinfo, tree, EXCEPT_CODE);
+ show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
}
ENDTRY;
}