diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-01-16 16:06:15 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-01-16 16:06:15 +0000 |
commit | 1c9781b4ec6e907548bf144f04bd2de850c38b76 (patch) | |
tree | d5c476ab5cc45bb308d2bf464913b3d7805504c2 /epan/dissectors/packet-frame.c | |
parent | 491ceb39058e9038aba4f35bae505f1af031a120 (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/packet-frame.c')
-rw-r--r-- | epan/dissectors/packet-frame.c | 16 |
1 files changed, 14 insertions, 2 deletions
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(); } } |