Restore pinfo->private_data after an exception was thrown by a subdissector.

This is necessary in case a subdissector had changed it but was unable to
restore it (due to the exception).

Remove check_col().

svn path=/trunk/; revision=34436
This commit is contained in:
Jeff Morriss 2010-10-08 17:48:22 +00:00
parent 7321549932
commit 33f116a46d
14 changed files with 242 additions and 132 deletions

View File

@ -404,7 +404,7 @@ static gint bgp_asn_len = 0;
*/ */
static int static int
decode_prefix4(proto_tree *tree, int hf_addr, tvbuff_t *tvb, gint offset, decode_prefix4(proto_tree *tree, int hf_addr, tvbuff_t *tvb, gint offset,
guint16 tlen, const char *tag) guint16 tlen, const char *tag)
{ {
proto_item *ti; proto_item *ti;
proto_tree *prefix_tree; proto_tree *prefix_tree;
@ -446,7 +446,7 @@ decode_prefix4(proto_tree *tree, int hf_addr, tvbuff_t *tvb, gint offset,
*/ */
static int static int
decode_prefix6(proto_tree *tree, int hf_addr, tvbuff_t *tvb, gint offset, decode_prefix6(proto_tree *tree, int hf_addr, tvbuff_t *tvb, gint offset,
guint16 tlen, const char *tag) guint16 tlen, const char *tag)
{ {
proto_item *ti; proto_item *ti;
proto_tree *prefix_tree; proto_tree *prefix_tree;
@ -658,7 +658,8 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbu
*/ */
static int static int
decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, const char *tag) guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset,
const char *tag)
{ {
int start_offset = offset; int start_offset = offset;
proto_item *ti; proto_item *ti;
@ -2720,7 +2721,7 @@ dissect_bgp_capability(tvbuff_t *tvb, proto_tree *tree)
static void static void
dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree, dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree,
gboolean first) gboolean first)
{ {
guint16 bgp_len; /* Message length */ guint16 bgp_len; /* Message length */
guint8 bgp_type; /* Message type */ guint8 bgp_type; /* Message type */
@ -2733,12 +2734,10 @@ dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree,
bgp_type = tvb_get_guint8(tvb, BGP_MARKER_SIZE + 2); bgp_type = tvb_get_guint8(tvb, BGP_MARKER_SIZE + 2);
typ = val_to_str(bgp_type, bgptypevals, "Unknown message type (0x%02x)"); typ = val_to_str(bgp_type, bgptypevals, "Unknown message type (0x%02x)");
if (check_col(pinfo->cinfo, COL_INFO)) { if (first)
if (first) col_add_str(pinfo->cinfo, COL_INFO, typ);
col_add_str(pinfo->cinfo, COL_INFO, typ); else
else col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", typ);
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", typ);
}
if (tree) { if (tree) {
ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, FALSE); ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, FALSE);
@ -2837,6 +2836,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint length; guint length;
volatile gboolean first = TRUE; /* TRUE for the first BGP message in packet */ volatile gboolean first = TRUE; /* TRUE for the first BGP message in packet */
tvbuff_t *volatile next_tvb; tvbuff_t *volatile next_tvb;
void *pd_save;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BGP"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "BGP");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -2982,6 +2982,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* If it gets a BoundsError, we can stop, as there's nothing more to * If it gets a BoundsError, we can stop, as there's nothing more to
* see, so we just re-throw it. * see, so we just re-throw it.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
dissect_bgp_pdu(next_tvb, pinfo, tree, first); dissect_bgp_pdu(next_tvb, pinfo, tree, first);
} }
@ -2989,6 +2990,12 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
RETHROW; RETHROW;
} }
CATCH(ReportedBoundsError) { CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} }
ENDTRY; ENDTRY;

View File

@ -1,5 +1,5 @@
/* packet-cwids.c /* packet-cwids.c
* Routines for dissecting wireless ids packets sent from a Cisco * Routines for dissecting wireless ids packets sent from a Cisco
* access point to the WLSE (or whatever) * access point to the WLSE (or whatever)
* *
* $Id$ * $Id$
@ -78,6 +78,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
volatile int offset = 0; volatile int offset = 0;
guint16 capturelen; guint16 capturelen;
guint remain; guint remain;
void *pd_save;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CWIDS"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "CWIDS");
col_set_str(pinfo->cinfo, COL_INFO, "Cwids: "); col_set_str(pinfo->cinfo, COL_INFO, "Cwids: ");
@ -88,7 +89,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
while((remain = tvb_length_remaining(tvb, offset)) > 0) { while((remain = tvb_length_remaining(tvb, offset)) > 0) {
ti = proto_tree_add_item(tree, proto_cwids, tvb, offset, 28, FALSE); ti = proto_tree_add_item(tree, proto_cwids, tvb, offset, 28, FALSE);
cwids_tree = proto_item_add_subtree(ti, ett_cwids); cwids_tree = proto_item_add_subtree(ti, ett_cwids);
proto_tree_add_item(cwids_tree, hf_cwids_version, tvb, offset, 2, FALSE); proto_tree_add_item(cwids_tree, hf_cwids_version, tvb, offset, 2, FALSE);
offset += 2; offset += 2;
proto_tree_add_item(cwids_tree, hf_cwids_unknown1, tvb, offset, 7, FALSE); proto_tree_add_item(cwids_tree, hf_cwids_unknown1, tvb, offset, 7, FALSE);
@ -104,9 +105,10 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 2; offset += 2;
proto_tree_add_item(cwids_tree, hf_cwids_unknown3, tvb, offset, 8, FALSE); proto_tree_add_item(cwids_tree, hf_cwids_unknown3, tvb, offset, 8, FALSE);
offset += 8; offset += 8;
wlan_tvb = tvb_new_subset(tvb, offset, capturelen, capturelen); wlan_tvb = tvb_new_subset(tvb, offset, capturelen, capturelen);
/* Continue after ieee80211 dissection errors */ /* Continue after ieee80211 dissection errors */
pd_save = pinfo->private_data;
TRY { TRY {
call_dissector(ieee80211_handle, wlan_tvb, pinfo, tree); call_dissector(ieee80211_handle, wlan_tvb, pinfo, tree);
} CATCH2(BoundsError, ReportedBoundsError) { } CATCH2(BoundsError, ReportedBoundsError) {
@ -115,6 +117,12 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
PI_MALFORMED, PI_ERROR, PI_MALFORMED, PI_ERROR,
"Malformed or short IEEE80211 subpacket"); "Malformed or short IEEE80211 subpacket");
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
if (check_col(pinfo->cinfo, COL_INFO)) { if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, col_append_str(pinfo->cinfo, COL_INFO,
" [Malformed or short IEEE80211 subpacket] " ); " [Malformed or short IEEE80211 subpacket] " );
@ -124,7 +132,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
wlan_tvb = tvb_new_subset(tvb, offset, capturelen, capturelen); wlan_tvb = tvb_new_subset(tvb, offset, capturelen, capturelen);
#if 0 #if 0
/* FIXME: Why does this throw an exception? */ /* FIXME: Why does this throw an exception? */
proto_tree_add_text(cwids_tree, wlan_tvb, offset, capturelen, proto_tree_add_text(cwids_tree, wlan_tvb, offset, capturelen,
"[Malformed or short IEEE80211 subpacket]"); "[Malformed or short IEEE80211 subpacket]");
#endif #endif
; ;

View File

@ -203,8 +203,8 @@ capture_ethertype(guint16 etype, const guchar *pd, int offset, int len,
void void
ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
int etype_id, int trailer_id, int fcs_len) int etype_id, int trailer_id, int fcs_len)
{ {
const char *description; const char *description;
tvbuff_t *volatile next_tvb; tvbuff_t *volatile next_tvb;
@ -212,6 +212,7 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
gint captured_length, reported_length; gint captured_length, reported_length;
volatile gboolean dissector_found = FALSE; volatile gboolean dissector_found = FALSE;
const char *volatile saved_proto; const char *volatile saved_proto;
void *pd_save;
/* Add the Ethernet type to the protocol tree */ /* Add the Ethernet type to the protocol tree */
if (tree) { if (tree) {
@ -252,6 +253,7 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
was reduced by some dissector before an exception was thrown, was reduced by some dissector before an exception was thrown,
we can still put in an item for the trailer. */ we can still put in an item for the trailer. */
saved_proto = pinfo->current_proto; saved_proto = pinfo->current_proto;
pd_save = pinfo->private_data;
TRY { TRY {
dissector_found = dissector_try_port(ethertype_dissector_table, dissector_found = dissector_try_port(ethertype_dissector_table,
etype, next_tvb, pinfo, tree); etype, next_tvb, pinfo, tree);
@ -286,6 +288,12 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
found and restoring the protocol value that was in effect found and restoring the protocol value that was in effect
before we called the subdissector. */ before we called the subdissector. */
show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE); show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
dissector_found = TRUE; dissector_found = TRUE;
pinfo->current_proto = saved_proto; pinfo->current_proto = saved_proto;
} }
@ -297,27 +305,22 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
call_dissector(data_handle,next_tvb, pinfo, tree); call_dissector(data_handle,next_tvb, pinfo, tree);
/* Label protocol */ /* Label protocol */
if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", etype);
col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x",
etype); description = match_strval(etype, etype_vals);
} if (description) {
if (check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO, description);
description = match_strval(etype, etype_vals);
if (description) {
col_add_str(pinfo->cinfo, COL_INFO,
description);
}
} }
} }
add_dix_trailer(pinfo, tree, fh_tree, trailer_id, tvb, next_tvb, offset_after_etype, add_dix_trailer(pinfo, tree, fh_tree, trailer_id, tvb, next_tvb, offset_after_etype,
length_before, fcs_len); length_before, fcs_len);
} }
static void static void
add_dix_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, int trailer_id, add_dix_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, int trailer_id,
tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype, tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype,
guint length_before, gint fcs_len) guint length_before, gint fcs_len)
{ {
guint length; guint length;
tvbuff_t *trailer_tvb; tvbuff_t *trailer_tvb;

View File

@ -120,7 +120,8 @@ static dissector_handle_t spnego_krb5_wrap_handle;
static GHashTable *gssapi_oids; static GHashTable *gssapi_oids;
static gint gssapi_oid_equal(gconstpointer k1, gconstpointer k2) static gint
gssapi_oid_equal(gconstpointer k1, gconstpointer k2)
{ {
const char *key1 = (const char *)k1; const char *key1 = (const char *)k1;
const char *key2 = (const char *)k2; const char *key2 = (const char *)k2;
@ -174,7 +175,7 @@ gssapi_lookup_oid_str(const char *oid_key)
static int static int
dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean is_verifier) gboolean is_verifier)
{ {
proto_item *volatile item; proto_item *volatile item;
proto_tree *volatile subtree; proto_tree *volatile subtree;
@ -195,6 +196,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gssapi_frag_info_t *fi; gssapi_frag_info_t *fi;
tvbuff_t *volatile gss_tvb=NULL; tvbuff_t *volatile gss_tvb=NULL;
asn1_ctx_t asn1_ctx; asn1_ctx_t asn1_ctx;
void *pd_save;
start_offset=0; start_offset=0;
offset=0; offset=0;
@ -239,6 +241,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* in the packet after our blob to see, so we just re-throw the * in the packet after our blob to see, so we just re-throw the
* exception. * exception.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
gss_tvb=tvb; gss_tvb=tvb;
@ -498,6 +501,11 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
} CATCH(BoundsError) { } CATCH(BoundsError) {
RETHROW; RETHROW;
} CATCH(ReportedBoundsError) { } CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(gss_tvb, pinfo, tree); show_reported_bounds_error(gss_tvb, pinfo, tree);
} ENDTRY; } ENDTRY;
@ -579,9 +587,9 @@ proto_register_gssapi(void)
register_init_routine(gssapi_reassembly_init); register_init_routine(gssapi_reassembly_init);
} }
static int wrap_dissect_gssapi(tvbuff_t *tvb, int offset, static int
packet_info *pinfo, wrap_dissect_gssapi(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep _U_) proto_tree *tree, guint8 *drep _U_)
{ {
tvbuff_t *auth_tvb; tvbuff_t *auth_tvb;
@ -592,9 +600,9 @@ static int wrap_dissect_gssapi(tvbuff_t *tvb, int offset,
return tvb_length_remaining(tvb, offset); return tvb_length_remaining(tvb, offset);
} }
int wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset, int
packet_info *pinfo, wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep _U_) proto_tree *tree, guint8 *drep _U_)
{ {
tvbuff_t *auth_tvb; tvbuff_t *auth_tvb;
@ -604,11 +612,9 @@ int wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset,
} }
tvbuff_t * tvbuff_t *
wrap_dissect_gssapi_payload(tvbuff_t *data_tvb, wrap_dissect_gssapi_payload(tvbuff_t *data_tvb, tvbuff_t *auth_tvb,
tvbuff_t *auth_tvb, int offset _U_, packet_info *pinfo,
int offset _U_, dcerpc_auth_info *auth_info _U_)
packet_info *pinfo,
dcerpc_auth_info *auth_info _U_)
{ {
tvbuff_t *result; tvbuff_t *result;

View File

@ -48,6 +48,7 @@ dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
tvbuff_t *volatile trailer_tvb = NULL; tvbuff_t *volatile trailer_tvb = NULL;
const char *saved_proto; const char *saved_proto;
gint captured_length, reported_length; gint captured_length, reported_length;
void *pd_save;
length_it = proto_tree_add_uint(fh_tree, length_id, tvb, length_it = proto_tree_add_uint(fh_tree, length_id, tvb,
offset_after_length - 2, 2, length); offset_after_length - 2, 2, length);
@ -96,6 +97,7 @@ dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
before an exception was thrown, we can still put in an item before an exception was thrown, we can still put in an item
for the trailer. */ for the trailer. */
saved_proto = pinfo->current_proto; saved_proto = pinfo->current_proto;
pd_save = pinfo->private_data;
TRY { TRY {
if (is_802_2) if (is_802_2)
call_dissector(llc_handle, next_tvb, pinfo, tree); call_dissector(llc_handle, next_tvb, pinfo, tree);
@ -122,6 +124,13 @@ dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
Show the exception, and then drive on to show the trailer, Show the exception, and then drive on to show the trailer,
restoring the protocol value that was in effect before we restoring the protocol value that was in effect before we
called the subdissector. */ called the subdissector. */
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE); show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
pinfo->current_proto = saved_proto; pinfo->current_proto = saved_proto;
} }

View File

@ -977,6 +977,7 @@ static void parse_PAYLOAD(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
dissector_found = parse_EoIB(parentTree, tvb, local_offset, pinfo); dissector_found = parse_EoIB(parentTree, tvb, local_offset, pinfo);
} }
else if (pref_identify_iba_payload && reserved == 0) { else if (pref_identify_iba_payload && reserved == 0) {
void *pd_save;
/* Get the captured length and reported length of the data /* Get the captured length and reported length of the data
after the Ethernet type. */ after the Ethernet type. */
@ -994,6 +995,7 @@ static void parse_PAYLOAD(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
was reduced by some dissector before an exception was thrown, was reduced by some dissector before an exception was thrown,
we can still put in an item for the trailer. */ we can still put in an item for the trailer. */
saved_proto = pinfo->current_proto; saved_proto = pinfo->current_proto;
pd_save = pinfo->private_data;
TRY { TRY {
dissector_found = dissector_try_port(ethertype_dissector_table, dissector_found = dissector_try_port(ethertype_dissector_table,
etype, next_tvb, pinfo, top_tree); etype, next_tvb, pinfo, top_tree);
@ -1027,6 +1029,13 @@ static void parse_PAYLOAD(proto_tree *parentTree, packet_info *pinfo, tvbuff_t *
to show the trailer, after noting that a dissector was to show the trailer, after noting that a dissector was
found and restoring the protocol value that was in effect found and restoring the protocol value that was in effect
before we called the subdissector. */ before we called the subdissector. */
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_exception(next_tvb, pinfo, top_tree, EXCEPT_CODE, GET_MESSAGE); show_exception(next_tvb, pinfo, top_tree, EXCEPT_CODE, GET_MESSAGE);
dissector_found = TRUE; dissector_found = TRUE;
pinfo->current_proto = saved_proto; pinfo->current_proto = saved_proto;

View File

@ -149,6 +149,7 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int fcs_len)
tvbuff_t *volatile next_tvb; tvbuff_t *volatile next_tvb;
tvbuff_t *volatile trailer_tvb = NULL; tvbuff_t *volatile trailer_tvb = NULL;
const char *saved_proto; const char *saved_proto;
void *pd_save;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISL"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISL");
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
@ -236,9 +237,8 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int fcs_len)
field (which is, admittedly, an OUI). */ field (which is, admittedly, an OUI). */
proto_tree_add_item(fh_tree, hf_isl_hsa, payload_tvb, 3, 3, FALSE); proto_tree_add_item(fh_tree, hf_isl_hsa, payload_tvb, 3, 3, FALSE);
} }
if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "VLAN ID: %u",
col_add_fstr(pinfo->cinfo, COL_INFO, "VLAN ID: %u", tvb_get_ntohs(tvb, 20) >> 1);
tvb_get_ntohs(tvb, 20) >> 1);
if (tree) { if (tree) {
proto_tree_add_item(fh_tree, hf_isl_vlan_id, payload_tvb, 6, 2, FALSE); proto_tree_add_item(fh_tree, hf_isl_vlan_id, payload_tvb, 6, 2, FALSE);
proto_tree_add_item(fh_tree, hf_isl_bpdu, payload_tvb, 6, 2, FALSE); proto_tree_add_item(fh_tree, hf_isl_bpdu, payload_tvb, 6, 2, FALSE);
@ -272,6 +272,7 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int fcs_len)
before an exception was thrown, we can still put in an item before an exception was thrown, we can still put in an item
for the trailer. */ for the trailer. */
saved_proto = pinfo->current_proto; saved_proto = pinfo->current_proto;
pd_save = pinfo->private_data;
TRY { TRY {
/* Frames encapsulated in ISL include an FCS. */ /* Frames encapsulated in ISL include an FCS. */
call_dissector(eth_withfcs_handle, next_tvb, pinfo, tree); call_dissector(eth_withfcs_handle, next_tvb, pinfo, tree);
@ -289,6 +290,13 @@ 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, Show the exception, and then drive on to show the trailer,
restoring the protocol value that was in effect before we restoring the protocol value that was in effect before we
called the subdissector. */ called the subdissector. */
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE); show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
pinfo->current_proto = saved_proto; pinfo->current_proto = saved_proto;
} }

View File

@ -271,9 +271,9 @@ get_docsis_packet_length(tvbuff_t * tvb, gint offset)
static void static void
mp2t_depi_docsis_fragmentation_handle(tvbuff_t *tvb, guint offset, mp2t_depi_docsis_fragmentation_handle(tvbuff_t *tvb, guint offset,
packet_info *pinfo, proto_tree *tree, packet_info *pinfo, proto_tree *tree,
guint frag_offset, guint frag_len, guint frag_offset, guint frag_len,
gboolean fragment_last) gboolean fragment_last)
{ {
fragment_data *frag_msg = NULL; fragment_data *frag_msg = NULL;
tvbuff_t *new_tvb = NULL; tvbuff_t *new_tvb = NULL;
@ -1006,6 +1006,7 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo,
if (tvb_get_ntoh24(tvb, offset) == 0x000001) { if (tvb_get_ntoh24(tvb, offset) == 0x000001) {
tvbuff_t *next_tvb = tvb_new_subset(tvb, offset, payload_len, payload_len); tvbuff_t *next_tvb = tvb_new_subset(tvb, offset, payload_len, payload_len);
const char *saved_proto = pinfo->current_proto; const char *saved_proto = pinfo->current_proto;
void *pd_save = pinfo->private_data;
TRY { TRY {
call_dissector(pes_handle, next_tvb, pinfo, mp2t_tree); call_dissector(pes_handle, next_tvb, pinfo, mp2t_tree);
@ -1019,6 +1020,11 @@ dissect_tsp(tvbuff_t *tvb, volatile gint offset, packet_info *pinfo,
media stream up into chunks of MP2T_PACKET_SIZE. media stream up into chunks of MP2T_PACKET_SIZE.
*/ */
CATCH2(BoundsError, ReportedBoundsError) { CATCH2(BoundsError, ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE); show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
pinfo->current_proto = saved_proto; pinfo->current_proto = saved_proto;
} }

View File

@ -252,9 +252,9 @@ nbns_type_name (int type)
static proto_tree * static proto_tree *
add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset, add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
const char *name, int namelen, const char *name, int namelen,
const char *type_name, const char *class_description, const char *type_name, const char *class_description,
guint ttl, gushort data_len) guint ttl, gushort data_len)
{ {
proto_tree *rr_tree; proto_tree *rr_tree;
@ -274,7 +274,7 @@ add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
static int static int
get_nbns_name(tvbuff_t *tvb, int offset, int nbns_data_offset, get_nbns_name(tvbuff_t *tvb, int offset, int nbns_data_offset,
char *name_ret, int name_ret_len, int *name_type_ret) char *name_ret, int name_ret_len, int *name_type_ret)
{ {
int name_len; int name_len;
const guchar *name; const guchar *name;
@ -369,8 +369,8 @@ bad:
static int static int
get_nbns_name_type_class(tvbuff_t *tvb, int offset, int nbns_data_offset, get_nbns_name_type_class(tvbuff_t *tvb, int offset, int nbns_data_offset,
char *name_ret, int *name_len_ret, int *name_type_ret, int *type_ret, char *name_ret, int *name_len_ret, int *name_type_ret,
int *class_ret) int *type_ret, int *class_ret)
{ {
int name_len; int name_len;
int type; int type;
@ -394,7 +394,7 @@ get_nbns_name_type_class(tvbuff_t *tvb, int offset, int nbns_data_offset,
static void static void
add_name_and_type(proto_tree *tree, tvbuff_t *tvb, int offset, int len, add_name_and_type(proto_tree *tree, tvbuff_t *tvb, int offset, int len,
const char *tag, const char *name, int name_type) const char *tag, const char *name, int name_type)
{ {
if (name_type != -1) { if (name_type != -1) {
proto_tree_add_text(tree, tvb, offset, len, "%s: %s (%s)", proto_tree_add_text(tree, tvb, offset, len, "%s: %s (%s)",
@ -409,7 +409,7 @@ add_name_and_type(proto_tree *tree, tvbuff_t *tvb, int offset, int len,
static int static int
dissect_nbns_query(tvbuff_t *tvb, int offset, int nbns_data_offset, dissect_nbns_query(tvbuff_t *tvb, int offset, int nbns_data_offset,
column_info *cinfo, proto_tree *nbns_tree) column_info *cinfo, proto_tree *nbns_tree)
{ {
int len; int len;
char *name; char *name;
@ -474,7 +474,7 @@ nbns_add_nbns_flags(column_info *cinfo, proto_tree *nbns_tree, tvbuff_t *tvb, in
g_strlcat(buf, ", ", MAX_BUF_SIZE); g_strlcat(buf, ", ", MAX_BUF_SIZE);
g_strlcat(buf, val_to_str(flags & F_RCODE, rcode_vals, "Unknown error"), MAX_BUF_SIZE); g_strlcat(buf, val_to_str(flags & F_RCODE, rcode_vals, "Unknown error"), MAX_BUF_SIZE);
buf[MAX_BUF_SIZE-1] = '\0'; buf[MAX_BUF_SIZE-1] = '\0';
if ((flags & F_RCODE) && check_col(cinfo, COL_INFO)) if ((flags & F_RCODE))
col_append_fstr(cinfo, COL_INFO, ", %s", col_append_fstr(cinfo, COL_INFO, ", %s",
val_to_str(flags & F_RCODE, rcode_vals, val_to_str(flags & F_RCODE, rcode_vals,
"Unknown error")); "Unknown error"));
@ -544,7 +544,7 @@ nbns_add_nb_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset, gushort flags)
static void static void
nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset, nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset,
gushort flags) gushort flags)
{ {
char *buf; char *buf;
proto_item *field_tree; proto_item *field_tree;
@ -608,7 +608,7 @@ nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset,
static int static int
dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset, dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset,
column_info *cinfo, proto_tree *nbns_tree, int opcode) column_info *cinfo, proto_tree *nbns_tree, int opcode)
{ {
int len; int len;
char *name; char *name;
@ -981,7 +981,7 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset,
static int static int
dissect_query_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset, dissect_query_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
int count, column_info *cinfo, proto_tree *nbns_tree) int count, column_info *cinfo, proto_tree *nbns_tree)
{ {
int start_off, add_off; int start_off, add_off;
proto_tree *qatree = NULL; proto_tree *qatree = NULL;
@ -1007,8 +1007,8 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
static int static int
dissect_answer_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset, dissect_answer_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
int count, column_info *cinfo, proto_tree *nbns_tree, int opcode, int count, column_info *cinfo, proto_tree *nbns_tree,
const char *name) int opcode, const char *name)
{ {
int start_off, add_off; int start_off, add_off;
proto_tree *qatree = NULL; proto_tree *qatree = NULL;
@ -1246,11 +1246,9 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
message_index = 0; message_index = 0;
} }
if (check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO,
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(header.msg_type, nbds_msgtype_vals, val_to_str(header.msg_type, nbds_msgtype_vals,
"Unknown message type (0x%02X)")); "Unknown message type (0x%02X)"));
}
if (tree) { if (tree) {
ti = proto_tree_add_item(tree, proto_nbdgm, tvb, offset, -1, ti = proto_tree_add_item(tree, proto_nbdgm, tvb, offset, -1,
@ -1400,7 +1398,7 @@ static const value_string error_codes[] = {
*/ */
static int static int
dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo, dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, int is_cifs) proto_tree *tree, int is_cifs)
{ {
proto_tree *nbss_tree = NULL; proto_tree *nbss_tree = NULL;
proto_item *ti = NULL; proto_item *ti = NULL;
@ -1416,6 +1414,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
gint reported_len; gint reported_len;
tvbuff_t *next_tvb; tvbuff_t *next_tvb;
const char *saved_proto; const char *saved_proto;
void *pd_save;
name=ep_alloc(MAX_NAME_LEN); name=ep_alloc(MAX_NAME_LEN);
@ -1533,8 +1532,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
"Called name", name, name_type); "Called name", name, name_type);
offset += len; offset += len;
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", to %s ", name);
col_append_fstr(pinfo->cinfo, COL_INFO, ", to %s ", name);
len = get_nbns_name(tvb, offset, offset, name, MAX_NAME_LEN, &name_type); len = get_nbns_name(tvb, offset, offset, name, MAX_NAME_LEN, &name_type);
@ -1542,8 +1540,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
add_name_and_type(nbss_tree, tvb, offset, len, add_name_and_type(nbss_tree, tvb, offset, len,
"Calling name", name, name_type); "Calling name", name, name_type);
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, "from %s", name);
col_append_fstr(pinfo->cinfo, COL_INFO, "from %s", name);
break; break;
@ -1554,10 +1551,9 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
val_to_str(tvb_get_guint8(tvb, offset), val_to_str(tvb_get_guint8(tvb, offset),
error_codes, "Unknown (%x)")); error_codes, "Unknown (%x)"));
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(tvb_get_guint8(tvb, offset),
val_to_str(tvb_get_guint8(tvb, offset), error_codes, "Unknown (%x)"));
error_codes, "Unknown (%x)"));
break; break;
@ -1603,6 +1599,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
* more to see, so we just re-throw it. * more to see, so we just re-throw it.
*/ */
saved_proto = pinfo->current_proto; saved_proto = pinfo->current_proto;
pd_save = pinfo->private_data;
TRY { TRY {
dissect_netbios_payload(next_tvb, pinfo, tree); dissect_netbios_payload(next_tvb, pinfo, tree);
} }
@ -1610,6 +1607,11 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
RETHROW; RETHROW;
} }
CATCH(ReportedBoundsError) { CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
pinfo->current_proto = saved_proto; pinfo->current_proto = saved_proto;
} }
@ -1790,10 +1792,8 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} }
} }
if (check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO,
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(msg_type, message_types, "Unknown (%02x)")); val_to_str(msg_type, message_types, "Unknown (%02x)"));
}
while (tvb_reported_length_remaining(tvb, offset) > 0) { while (tvb_reported_length_remaining(tvb, offset) > 0) {
len = dissect_nbss_packet(tvb, offset, pinfo, tree, is_cifs); len = dissect_nbss_packet(tvb, offset, pinfo, tree, is_cifs);

View File

@ -1746,9 +1746,8 @@ dissect_ntlmssp_auth (tvbuff_t *tvb, packet_info *pinfo, int offset,
data_start = MIN(data_start, item_start); data_start = MIN(data_start, item_start);
data_end = MAX(data_end, item_end); data_end = MAX(data_end, item_end);
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", User: %s\\%s",
col_append_fstr(pinfo->cinfo, COL_INFO, ", User: %s\\%s", ntlmssph->domain_name, ntlmssph->acct_name);
ntlmssph->domain_name, ntlmssph->acct_name);
/* hostname */ /* hostname */
item_start = tvb_get_letohl(tvb, offset+4); item_start = tvb_get_letohl(tvb, offset+4);
@ -1935,6 +1934,8 @@ dissect_ntlmssp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
guint32 ntlm_magic_size = 4; guint32 ntlm_magic_size = 4;
guint32 ntlm_signature_size = 8; guint32 ntlm_signature_size = 8;
guint32 ntlm_seq_size = 4; guint32 ntlm_seq_size = 4;
void *pd_save;
length = tvb_length (tvb); length = tvb_length (tvb);
/* signature + seq + real payload */ /* signature + seq + real payload */
encrypted_block_length = length - ntlm_magic_size; encrypted_block_length = length - ntlm_magic_size;
@ -1967,6 +1968,7 @@ dissect_ntlmssp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
* in the packet after our blob to see, so we just re-throw the * in the packet after our blob to see, so we just re-throw the
* exception. * exception.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
/* Version number */ /* Version number */
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_vers, proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_vers,
@ -1986,6 +1988,11 @@ dissect_ntlmssp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
} CATCH(BoundsError) { } CATCH(BoundsError) {
RETHROW; RETHROW;
} CATCH(ReportedBoundsError) { } CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} ENDTRY; } ENDTRY;
@ -2107,6 +2114,7 @@ dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *volatile ntlmssp_tree = NULL; proto_tree *volatile ntlmssp_tree = NULL;
proto_item *tf = NULL; proto_item *tf = NULL;
ntlmssp_header_t *ntlmssph; ntlmssp_header_t *ntlmssph;
void *pd_save;
ntlmssph=ep_alloc(sizeof(ntlmssp_header_t)); ntlmssph=ep_alloc(sizeof(ntlmssp_header_t));
ntlmssph->type=0; ntlmssph->type=0;
@ -2136,6 +2144,7 @@ dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* in the packet after our blob to see, so we just re-throw the * in the packet after our blob to see, so we just re-throw the
* exception. * exception.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
/* NTLMSSP constant */ /* NTLMSSP constant */
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_auth, proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_auth,
@ -2148,11 +2157,10 @@ dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ntlmssph->type = tvb_get_letohl (tvb, offset); ntlmssph->type = tvb_get_letohl (tvb, offset);
offset += 4; offset += 4;
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(ntlmssph->type,
val_to_str(ntlmssph->type, ntlmssp_message_types,
ntlmssp_message_types, "Unknown message type"));
"Unknown message type"));
/* Call the appropriate dissector based on the Message Type */ /* Call the appropriate dissector based on the Message Type */
switch (ntlmssph->type) { switch (ntlmssph->type) {
@ -2178,6 +2186,11 @@ dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} CATCH(BoundsError) { } CATCH(BoundsError) {
RETHROW; RETHROW;
} CATCH(ReportedBoundsError) { } CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} ENDTRY; } ENDTRY;
@ -2365,6 +2378,8 @@ dissect_ntlmssp_payload_only(tvbuff_t *tvb, packet_info *pinfo, _U_ proto_tree *
volatile int offset = 0; volatile int offset = 0;
proto_tree *volatile ntlmssp_tree = NULL; proto_tree *volatile ntlmssp_tree = NULL;
guint32 encrypted_block_length; guint32 encrypted_block_length;
void *pd_save;
/* the magic ntlm is the identifier of a NTLMSSP packet that's 00 00 00 01 /* the magic ntlm is the identifier of a NTLMSSP packet that's 00 00 00 01
*/ */
encrypted_block_length = tvb_length (tvb); encrypted_block_length = tvb_length (tvb);
@ -2393,6 +2408,7 @@ dissect_ntlmssp_payload_only(tvbuff_t *tvb, packet_info *pinfo, _U_ proto_tree *
* in the packet after our blob to see, so we just re-throw the * in the packet after our blob to see, so we just re-throw the
* exception. * exception.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
/* Version number */ /* Version number */
@ -2403,6 +2419,11 @@ dissect_ntlmssp_payload_only(tvbuff_t *tvb, packet_info *pinfo, _U_ proto_tree *
} CATCH(BoundsError) { } CATCH(BoundsError) {
RETHROW; RETHROW;
} CATCH(ReportedBoundsError) { } CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} ENDTRY; } ENDTRY;
@ -2420,6 +2441,7 @@ dissect_ntlmssp_verf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *tf = NULL; proto_item *tf = NULL;
guint32 verifier_length; guint32 verifier_length;
guint32 encrypted_block_length; guint32 encrypted_block_length;
void *pd_save;
verifier_length = tvb_length (tvb); verifier_length = tvb_length (tvb);
encrypted_block_length = verifier_length - 4; encrypted_block_length = verifier_length - 4;
@ -2452,6 +2474,7 @@ dissect_ntlmssp_verf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* in the packet after our blob to see, so we just re-throw the * in the packet after our blob to see, so we just re-throw the
* exception. * exception.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
/* Version number */ /* Version number */
proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_vers, proto_tree_add_item (ntlmssp_tree, hf_ntlmssp_verf_vers,
@ -2471,6 +2494,11 @@ dissect_ntlmssp_verf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} CATCH(BoundsError) { } CATCH(BoundsError) {
RETHROW; RETHROW;
} CATCH(ReportedBoundsError) { } CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} ENDTRY; } ENDTRY;

View File

@ -687,7 +687,7 @@ void proto_reg_handoff_sflow_245(void);
/* dissect a sampled header - layer 2 protocols */ /* dissect a sampled header - layer 2 protocols */
static gint static gint
dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo, dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, volatile gint offset) { proto_tree *tree, volatile gint offset) {
guint32 version, header_proto, frame_length, stripped; guint32 version, header_proto, frame_length, stripped;
volatile guint32 header_length; volatile guint32 header_length;
tvbuff_t *next_tvb; tvbuff_t *next_tvb;
@ -697,12 +697,13 @@ dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo,
* Thanks to Guy Harris for the tip. */ * Thanks to Guy Harris for the tip. */
gboolean save_writable; gboolean save_writable;
gboolean save_in_error_pkt; gboolean save_in_error_pkt;
volatile address save_dl_src; address save_dl_src;
volatile address save_dl_dst; address save_dl_dst;
volatile address save_net_src; address save_net_src;
volatile address save_net_dst; address save_net_dst;
volatile address save_src; address save_src;
volatile address save_dst; address save_dst;
void *pd_save;
version = tvb_get_ntohl(tvb, 0); version = tvb_get_ntohl(tvb, 0);
header_proto = tvb_get_ntohl(tvb, offset); header_proto = tvb_get_ntohl(tvb, offset);
@ -766,6 +767,7 @@ dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo,
save_net_dst = pinfo->net_dst; save_net_dst = pinfo->net_dst;
save_src = pinfo->src; save_src = pinfo->src;
save_dst = pinfo->dst; save_dst = pinfo->dst;
pd_save = pinfo->private_data;
TRY TRY
{ {
@ -825,7 +827,11 @@ dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo,
} }
CATCH2(BoundsError, ReportedBoundsError) { CATCH2(BoundsError, ReportedBoundsError) {
; /* do nothing */ /* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
} }
ENDTRY; ENDTRY;
@ -2682,8 +2688,7 @@ dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
guint i = 0; guint i = 0;
/* Make entries in Protocol column and Info column on summary display */ /* Make entries in Protocol column and Info column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "sFlow");
col_set_str(pinfo->cinfo, COL_PROTOCOL, "sFlow");
/* create display subtree for the protocol */ /* create display subtree for the protocol */
@ -2692,8 +2697,7 @@ dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
sflow_245_tree = proto_item_add_subtree(ti, ett_sflow_245); sflow_245_tree = proto_item_add_subtree(ti, ett_sflow_245);
version = tvb_get_ntohl(tvb, offset); version = tvb_get_ntohl(tvb, offset);
if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "V%u", version);
col_add_fstr(pinfo->cinfo, COL_INFO, "V%u", version);
proto_tree_add_item(sflow_245_tree, hf_sflow_version, tvb, offset, 4, FALSE); proto_tree_add_item(sflow_245_tree, hf_sflow_version, tvb, offset, 4, FALSE);
offset += 4; offset += 4;
@ -2702,15 +2706,13 @@ dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
switch (agent_addr_type) { switch (agent_addr_type) {
case ADDR_TYPE_IPV4: case ADDR_TYPE_IPV4:
tvb_memcpy(tvb, agent_address.v4, offset, 4); tvb_memcpy(tvb, agent_address.v4, offset, 4);
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", agent %s", ip_to_str(agent_address.v4));
col_append_fstr(pinfo->cinfo, COL_INFO, ", agent %s", ip_to_str(agent_address.v4));
proto_tree_add_item(sflow_245_tree, hf_sflow_agent_address_v4, tvb, offset, 4, FALSE); proto_tree_add_item(sflow_245_tree, hf_sflow_agent_address_v4, tvb, offset, 4, FALSE);
offset += 4; offset += 4;
break; break;
case ADDR_TYPE_IPV6: case ADDR_TYPE_IPV6:
tvb_memcpy(tvb, agent_address.v6, offset, 16); tvb_memcpy(tvb, agent_address.v6, offset, 16);
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", agent %s",
col_append_fstr(pinfo->cinfo, COL_INFO, ", agent %s",
ip6_to_str((struct e_in6_addr *) agent_address.v6)); ip6_to_str((struct e_in6_addr *) agent_address.v6));
proto_tree_add_item(sflow_245_tree, hf_sflow_agent_address_v6, tvb, offset, 16, FALSE); proto_tree_add_item(sflow_245_tree, hf_sflow_agent_address_v6, tvb, offset, 16, FALSE);
offset += 16; offset += 16;
@ -2722,21 +2724,18 @@ dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (version == 5) { if (version == 5) {
sub_agent_id = tvb_get_ntohl(tvb, offset); sub_agent_id = tvb_get_ntohl(tvb, offset);
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", sub-agent ID %u", sub_agent_id);
col_append_fstr(pinfo->cinfo, COL_INFO, ", sub-agent ID %u", sub_agent_id);
proto_tree_add_uint(sflow_245_tree, hf_sflow_5_sub_agent_id, tvb, offset, 4, sub_agent_id); proto_tree_add_uint(sflow_245_tree, hf_sflow_5_sub_agent_id, tvb, offset, 4, sub_agent_id);
offset += 4; offset += 4;
} }
seqnum = tvb_get_ntohl(tvb, offset); seqnum = tvb_get_ntohl(tvb, offset);
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", seq %u", seqnum);
col_append_fstr(pinfo->cinfo, COL_INFO, ", seq %u", seqnum);
proto_tree_add_uint(sflow_245_tree, hf_sflow_245_seqnum, tvb, offset, 4, seqnum); proto_tree_add_uint(sflow_245_tree, hf_sflow_245_seqnum, tvb, offset, 4, seqnum);
offset += 4; offset += 4;
proto_tree_add_item(sflow_245_tree, hf_sflow_245_sysuptime, tvb, offset, 4, FALSE); proto_tree_add_item(sflow_245_tree, hf_sflow_245_sysuptime, tvb, offset, 4, FALSE);
offset += 4; offset += 4;
numsamples = tvb_get_ntohl(tvb, offset); numsamples = tvb_get_ntohl(tvb, offset);
if (check_col(pinfo->cinfo, COL_INFO)) col_append_fstr(pinfo->cinfo, COL_INFO, ", %u samples", numsamples);
col_append_fstr(pinfo->cinfo, COL_INFO, ", %u samples", numsamples);
proto_tree_add_uint(sflow_245_tree, hf_sflow_245_numsamples, tvb, offset, 4, numsamples); proto_tree_add_uint(sflow_245_tree, hf_sflow_245_numsamples, tvb, offset, 4, numsamples);
offset += 4; offset += 4;

View File

@ -1523,10 +1523,10 @@ static gboolean tcp_desegment = TRUE;
static void static void
desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset, desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
guint32 seq, guint32 nxtseq, guint32 seq, guint32 nxtseq,
guint32 sport, guint32 dport, guint32 sport, guint32 dport,
proto_tree *tree, proto_tree *tcp_tree, proto_tree *tree, proto_tree *tcp_tree,
struct tcp_analysis *tcpd) struct tcp_analysis *tcpd)
{ {
struct tcpinfo *tcpinfo = pinfo->private_data; struct tcpinfo *tcpinfo = pinfo->private_data;
fragment_data *ipfd_head; fragment_data *ipfd_head;
@ -1956,9 +1956,9 @@ again:
*/ */
void void
tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean proto_desegment, guint fixed_len, gboolean proto_desegment, guint fixed_len,
guint (*get_pdu_len)(packet_info *, tvbuff_t *, int), guint (*get_pdu_len)(packet_info *, tvbuff_t *, int),
dissector_t dissect_pdu) dissector_t dissect_pdu)
{ {
volatile int offset = 0; volatile int offset = 0;
int offset_before; int offset_before;
@ -1967,6 +1967,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint length; guint length;
tvbuff_t *next_tvb; tvbuff_t *next_tvb;
proto_item *item=NULL; proto_item *item=NULL;
void *pd_save;
while (tvb_reported_length_remaining(tvb, offset) != 0) { while (tvb_reported_length_remaining(tvb, offset) != 0) {
/* /*
@ -2093,6 +2094,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* If it gets a BoundsError, we can stop, as there's nothing more to * If it gets a BoundsError, we can stop, as there's nothing more to
* see, so we just re-throw it. * see, so we just re-throw it.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
(*dissect_pdu)(next_tvb, pinfo, tree); (*dissect_pdu)(next_tvb, pinfo, tree);
} }
@ -2100,6 +2102,11 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
RETHROW; RETHROW;
} }
CATCH(ReportedBoundsError) { CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} }
ENDTRY; ENDTRY;

View File

@ -1728,6 +1728,7 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvbuff_t *volatile next_tvb; tvbuff_t *volatile next_tvb;
proto_item *tds_item = NULL; proto_item *tds_item = NULL;
proto_tree *tds_tree = NULL; proto_tree *tds_tree = NULL;
void *pd_save;
while (tvb_reported_length_remaining(tvb, offset) != 0) { while (tvb_reported_length_remaining(tvb, offset) != 0) {
length_remaining = tvb_ensure_length_remaining(tvb, offset); length_remaining = tvb_ensure_length_remaining(tvb, offset);
@ -1815,11 +1816,9 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* Set the packet description based on its TDS packet * Set the packet description based on its TDS packet
* type. * type.
*/ */
if (check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO,
col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, packet_type_names,
val_to_str(type, packet_type_names, "Unknown Packet Type: %u"));
"Unknown Packet Type: %u"));
}
first_time = FALSE; first_time = FALSE;
} }
@ -1856,6 +1855,7 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* If it gets a BoundsError, we can stop, as there's nothing * If it gets a BoundsError, we can stop, as there's nothing
* more to see, so we just re-throw it. * more to see, so we just re-throw it.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
dissect_netlib_buffer(next_tvb, pinfo, tree); dissect_netlib_buffer(next_tvb, pinfo, tree);
} }
@ -1863,6 +1863,12 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
RETHROW; RETHROW;
} }
CATCH(ReportedBoundsError) { CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} }
ENDTRY; ENDTRY;

View File

@ -203,7 +203,7 @@ int parseReservedText ( guint8* pTpktData )
*/ */
void void
dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
dissector_handle_t subdissector_handle) dissector_handle_t subdissector_handle)
{ {
proto_item *ti = NULL; proto_item *ti = NULL;
proto_tree *tpkt_tree = NULL; proto_tree *tpkt_tree = NULL;
@ -217,6 +217,8 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
tvbuff_t *volatile next_tvb; tvbuff_t *volatile next_tvb;
const char *saved_proto; const char *saved_proto;
guint8 string[4]; guint8 string[4];
void *pd_save;
/* /*
* If we're reassembling segmented TPKT PDUs, empty the COL_INFO * If we're reassembling segmented TPKT PDUs, empty the COL_INFO
* column, so subdissectors can append information * column, so subdissectors can append information
@ -227,7 +229,7 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* which case we'd have to zero the buffer out explicitly * which case we'd have to zero the buffer out explicitly
* anyway. * anyway.
*/ */
if (tpkt_desegment && check_col(pinfo->cinfo, COL_INFO)) if (tpkt_desegment)
col_add_str(pinfo->cinfo, COL_INFO, ""); col_add_str(pinfo->cinfo, COL_INFO, "");
while (tvb_reported_length_remaining(tvb, offset) != 0) { while (tvb_reported_length_remaining(tvb, offset) != 0) {
@ -287,8 +289,7 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* information without getting TPKT stuff in the middle; * information without getting TPKT stuff in the middle;
* why the second? * why the second?
*/ */
if (!tpkt_desegment && !pinfo->fragmented if (!tpkt_desegment && !pinfo->fragmented) {
&& check_col(pinfo->cinfo, COL_INFO)) {
col_add_fstr(pinfo->cinfo, COL_INFO, col_add_fstr(pinfo->cinfo, COL_INFO,
"TPKT Data length = %u", data_len); "TPKT Data length = %u", data_len);
} }
@ -333,7 +334,7 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* If it gets a BoundsError, we can stop, as there's nothing * If it gets a BoundsError, we can stop, as there's nothing
* more to see, so we just re-throw it. * more to see, so we just re-throw it.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
call_dissector(subdissector_handle, next_tvb, pinfo, call_dissector(subdissector_handle, next_tvb, pinfo,
tree); tree);
@ -342,6 +343,12 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
RETHROW; RETHROW;
} }
CATCH(ReportedBoundsError) { CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} }
ENDTRY; ENDTRY;
@ -358,7 +365,7 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/ */
void void
dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean desegment, dissector_handle_t subdissector_handle) gboolean desegment, dissector_handle_t subdissector_handle)
{ {
proto_item *ti = NULL; proto_item *ti = NULL;
proto_tree *tpkt_tree = NULL; proto_tree *tpkt_tree = NULL;
@ -368,6 +375,7 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
volatile int length; volatile int length;
tvbuff_t *volatile next_tvb; tvbuff_t *volatile next_tvb;
const char *saved_proto; const char *saved_proto;
void *pd_save;
/* /*
* If we're reassembling segmented TPKT PDUs, empty the COL_INFO * If we're reassembling segmented TPKT PDUs, empty the COL_INFO
@ -379,7 +387,7 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* which case we'd have to zero the buffer out explicitly * which case we'd have to zero the buffer out explicitly
* anyway. * anyway.
*/ */
if (desegment && check_col(pinfo->cinfo, COL_INFO)) if (desegment)
col_set_str(pinfo->cinfo, COL_INFO, ""); col_set_str(pinfo->cinfo, COL_INFO, "");
while (tvb_reported_length_remaining(tvb, offset) != 0) { while (tvb_reported_length_remaining(tvb, offset) != 0) {
@ -475,8 +483,7 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* information without getting TPKT stuff in the middle; * information without getting TPKT stuff in the middle;
* why the second? * why the second?
*/ */
if (!desegment && !pinfo->fragmented if (!desegment && !pinfo->fragmented) {
&& check_col(pinfo->cinfo, COL_INFO)) {
col_add_fstr(pinfo->cinfo, COL_INFO, col_add_fstr(pinfo->cinfo, COL_INFO,
"TPKT Data length = %u", data_len); "TPKT Data length = %u", data_len);
} }
@ -541,6 +548,7 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* If it gets a BoundsError, we can stop, as there's nothing * If it gets a BoundsError, we can stop, as there's nothing
* more to see, so we just re-throw it. * more to see, so we just re-throw it.
*/ */
pd_save = pinfo->private_data;
TRY { TRY {
call_dissector(subdissector_handle, next_tvb, pinfo, call_dissector(subdissector_handle, next_tvb, pinfo,
tree); tree);
@ -549,6 +557,12 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
RETHROW; RETHROW;
} }
CATCH(ReportedBoundsError) { CATCH(ReportedBoundsError) {
/* Restore the private_data structure in case one of the
* called dissectors modified it (and, due to the exception,
* was unable to restore it).
*/
pinfo->private_data = pd_save;
show_reported_bounds_error(tvb, pinfo, tree); show_reported_bounds_error(tvb, pinfo, tree);
} }
ENDTRY; ENDTRY;
@ -644,7 +658,7 @@ proto_register_tpkt(void)
proto_register_field_array(proto_tpkt, hf, array_length(hf)); proto_register_field_array(proto_tpkt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));
register_dissector("tpkt", dissect_tpkt, proto_tpkt); register_dissector("tpkt", dissect_tpkt, proto_tpkt);
tpkt_module = prefs_register_protocol(proto_tpkt, NULL); tpkt_module = prefs_register_protocol(proto_tpkt, NULL);
prefs_register_bool_preference(tpkt_module, "desegment", prefs_register_bool_preference(tpkt_module, "desegment",
"Reassemble TPKT messages spanning multiple TCP segments", "Reassemble TPKT messages spanning multiple TCP segments",
@ -665,10 +679,10 @@ proto_reg_handoff_tpkt(void)
x224_handle = find_dissector("x224"); x224_handle = find_dissector("x224");
tpkt_x224_handle = create_dissector_handle(dissect_tpkt_x224, proto_tpkt); tpkt_x224_handle = create_dissector_handle(dissect_tpkt_x224, proto_tpkt);
dissector_add("tcp.port", TCP_PORT_TPKT_X224, tpkt_x224_handle); dissector_add("tcp.port", TCP_PORT_TPKT_X224, tpkt_x224_handle);
/* /*
tpkt_ascii_handle = create_dissector_handle(dissect_ascii_tpkt, proto_tpkt); tpkt_ascii_handle = create_dissector_handle(dissect_ascii_tpkt, proto_tpkt);
dissector_add("tcp.port", TCP_PORT_TPKT, tpkt_ascii_handle); dissector_add("tcp.port", TCP_PORT_TPKT, tpkt_ascii_handle);
*/ */
} }