aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-bgp.c27
-rw-r--r--epan/dissectors/packet-cisco-wids.c16
-rw-r--r--epan/dissectors/packet-ethertype.c33
-rw-r--r--epan/dissectors/packet-gssapi.c32
-rw-r--r--epan/dissectors/packet-ieee8023.c9
-rw-r--r--epan/dissectors/packet-infiniband.c9
-rw-r--r--epan/dissectors/packet-isl.c14
-rw-r--r--epan/dissectors/packet-mp2t.c12
-rw-r--r--epan/dissectors/packet-nbns.c60
-rw-r--r--epan/dissectors/packet-ntlmssp.c44
-rw-r--r--epan/dissectors/packet-sflow.c43
-rw-r--r--epan/dissectors/packet-tcp.c21
-rw-r--r--epan/dissectors/packet-tds.c16
-rw-r--r--epan/dissectors/packet-tpkt.c38
14 files changed, 242 insertions, 132 deletions
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c
index cee53ddfe8..14511d5264 100644
--- a/epan/dissectors/packet-bgp.c
+++ b/epan/dissectors/packet-bgp.c
@@ -404,7 +404,7 @@ static gint bgp_asn_len = 0;
*/
static int
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_tree *prefix_tree;
@@ -446,7 +446,7 @@ decode_prefix4(proto_tree *tree, int hf_addr, tvbuff_t *tvb, gint offset,
*/
static int
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_tree *prefix_tree;
@@ -658,7 +658,8 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbu
*/
static int
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;
proto_item *ti;
@@ -2720,7 +2721,7 @@ dissect_bgp_capability(tvbuff_t *tvb, proto_tree *tree)
static void
dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree,
- gboolean first)
+ gboolean first)
{
guint16 bgp_len; /* Message length */
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);
typ = val_to_str(bgp_type, bgptypevals, "Unknown message type (0x%02x)");
- if (check_col(pinfo->cinfo, COL_INFO)) {
- if (first)
- col_add_str(pinfo->cinfo, COL_INFO, typ);
- else
- col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", typ);
- }
+ if (first)
+ col_add_str(pinfo->cinfo, COL_INFO, typ);
+ else
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", typ);
if (tree) {
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;
volatile gboolean first = TRUE; /* TRUE for the first BGP message in packet */
tvbuff_t *volatile next_tvb;
+ void *pd_save;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BGP");
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
* see, so we just re-throw it.
*/
+ pd_save = pinfo->private_data;
TRY {
dissect_bgp_pdu(next_tvb, pinfo, tree, first);
}
@@ -2989,6 +2990,12 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
RETHROW;
}
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);
}
ENDTRY;
diff --git a/epan/dissectors/packet-cisco-wids.c b/epan/dissectors/packet-cisco-wids.c
index 90ad0556d7..9d448fe9a6 100644
--- a/epan/dissectors/packet-cisco-wids.c
+++ b/epan/dissectors/packet-cisco-wids.c
@@ -1,5 +1,5 @@
/* 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)
*
* $Id$
@@ -78,6 +78,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
volatile int offset = 0;
guint16 capturelen;
guint remain;
+ void *pd_save;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "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) {
ti = proto_tree_add_item(tree, proto_cwids, tvb, offset, 28, FALSE);
cwids_tree = proto_item_add_subtree(ti, ett_cwids);
-
+
proto_tree_add_item(cwids_tree, hf_cwids_version, tvb, offset, 2, FALSE);
offset += 2;
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;
proto_tree_add_item(cwids_tree, hf_cwids_unknown3, tvb, offset, 8, FALSE);
offset += 8;
-
+
wlan_tvb = tvb_new_subset(tvb, offset, capturelen, capturelen);
/* Continue after ieee80211 dissection errors */
+ pd_save = pinfo->private_data;
TRY {
call_dissector(ieee80211_handle, wlan_tvb, pinfo, tree);
} CATCH2(BoundsError, ReportedBoundsError) {
@@ -115,6 +117,12 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
PI_MALFORMED, PI_ERROR,
"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)) {
col_append_str(pinfo->cinfo, COL_INFO,
" [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);
#if 0
/* 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]");
#endif
;
diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c
index 18d615a6cb..4f1e8d738e 100644
--- a/epan/dissectors/packet-ethertype.c
+++ b/epan/dissectors/packet-ethertype.c
@@ -203,8 +203,8 @@ capture_ethertype(guint16 etype, const guchar *pd, int offset, int len,
void
ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
- packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
- int etype_id, int trailer_id, int fcs_len)
+ packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
+ int etype_id, int trailer_id, int fcs_len)
{
const char *description;
tvbuff_t *volatile next_tvb;
@@ -212,6 +212,7 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
gint captured_length, reported_length;
volatile gboolean dissector_found = FALSE;
const char *volatile saved_proto;
+ void *pd_save;
/* Add the Ethernet type to the protocol 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,
we can still put in an item for the trailer. */
saved_proto = pinfo->current_proto;
+ pd_save = pinfo->private_data;
TRY {
dissector_found = dissector_try_port(ethertype_dissector_table,
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
before we called the subdissector. */
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;
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);
/* Label protocol */
- if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
- col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x",
- etype);
- }
- if (check_col(pinfo->cinfo, COL_INFO)) {
- description = match_strval(etype, etype_vals);
- if (description) {
- col_add_str(pinfo->cinfo, COL_INFO,
- description);
- }
+ col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", etype);
+
+ 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,
- length_before, fcs_len);
+ length_before, fcs_len);
}
static void
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,
- guint length_before, gint fcs_len)
+ tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype,
+ guint length_before, gint fcs_len)
{
guint length;
tvbuff_t *trailer_tvb;
diff --git a/epan/dissectors/packet-gssapi.c b/epan/dissectors/packet-gssapi.c
index e99b1f93ca..ae655bb6a4 100644
--- a/epan/dissectors/packet-gssapi.c
+++ b/epan/dissectors/packet-gssapi.c
@@ -120,7 +120,8 @@ static dissector_handle_t spnego_krb5_wrap_handle;
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 *key2 = (const char *)k2;
@@ -174,7 +175,7 @@ gssapi_lookup_oid_str(const char *oid_key)
static int
dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- gboolean is_verifier)
+ gboolean is_verifier)
{
proto_item *volatile item;
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;
tvbuff_t *volatile gss_tvb=NULL;
asn1_ctx_t asn1_ctx;
+ void *pd_save;
start_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
* exception.
*/
+ pd_save = pinfo->private_data;
TRY {
gss_tvb=tvb;
@@ -498,6 +501,11 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
} CATCH(BoundsError) {
RETHROW;
} 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);
} ENDTRY;
@@ -579,9 +587,9 @@ proto_register_gssapi(void)
register_init_routine(gssapi_reassembly_init);
}
-static int wrap_dissect_gssapi(tvbuff_t *tvb, int offset,
- packet_info *pinfo,
- proto_tree *tree, guint8 *drep _U_)
+static int
+wrap_dissect_gssapi(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep _U_)
{
tvbuff_t *auth_tvb;
@@ -592,9 +600,9 @@ static int wrap_dissect_gssapi(tvbuff_t *tvb, int offset,
return tvb_length_remaining(tvb, offset);
}
-int wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset,
- packet_info *pinfo,
- proto_tree *tree, guint8 *drep _U_)
+int
+wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep _U_)
{
tvbuff_t *auth_tvb;
@@ -604,11 +612,9 @@ int wrap_dissect_gssapi_verf(tvbuff_t *tvb, int offset,
}
tvbuff_t *
-wrap_dissect_gssapi_payload(tvbuff_t *data_tvb,
- tvbuff_t *auth_tvb,
- int offset _U_,
- packet_info *pinfo,
- dcerpc_auth_info *auth_info _U_)
+wrap_dissect_gssapi_payload(tvbuff_t *data_tvb, tvbuff_t *auth_tvb,
+ int offset _U_, packet_info *pinfo,
+ dcerpc_auth_info *auth_info _U_)
{
tvbuff_t *result;
diff --git a/epan/dissectors/packet-ieee8023.c b/epan/dissectors/packet-ieee8023.c
index fd98547218..0cdcc46714 100644
--- a/epan/dissectors/packet-ieee8023.c
+++ b/epan/dissectors/packet-ieee8023.c
@@ -48,6 +48,7 @@ dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
tvbuff_t *volatile trailer_tvb = NULL;
const char *saved_proto;
gint captured_length, reported_length;
+ void *pd_save;
length_it = proto_tree_add_uint(fh_tree, length_id, tvb,
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
for the trailer. */
saved_proto = pinfo->current_proto;
+ pd_save = pinfo->private_data;
TRY {
if (is_802_2)
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,
restoring the protocol value that was in effect 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, tree, EXCEPT_CODE, GET_MESSAGE);
pinfo->current_proto = saved_proto;
}
diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c
index 660db0d9c4..9376be06c2 100644
--- a/epan/dissectors/packet-infiniband.c
+++ b/epan/dissectors/packet-infiniband.c
@@ -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);
}
else if (pref_identify_iba_payload && reserved == 0) {
+ void *pd_save;
/* Get the captured length and reported length of the data
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,
we can still put in an item for the trailer. */
saved_proto = pinfo->current_proto;
+ pd_save = pinfo->private_data;
TRY {
dissector_found = dissector_try_port(ethertype_dissector_table,
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
found and restoring the protocol value that was in effect
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);
dissector_found = TRUE;
pinfo->current_proto = saved_proto;
diff --git a/epan/dissectors/packet-isl.c b/epan/dissectors/packet-isl.c
index 7363a5e577..1edb606018 100644
--- a/epan/dissectors/packet-isl.c
+++ b/epan/dissectors/packet-isl.c
@@ -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 trailer_tvb = NULL;
const char *saved_proto;
+ void *pd_save;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISL");
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). */
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",
- tvb_get_ntohs(tvb, 20) >> 1);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "VLAN ID: %u",
+ tvb_get_ntohs(tvb, 20) >> 1);
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_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
for the trailer. */
saved_proto = pinfo->current_proto;
+ pd_save = pinfo->private_data;
TRY {
/* Frames encapsulated in ISL include an FCS. */
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,
restoring the protocol value that was in effect 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, tree, EXCEPT_CODE, GET_MESSAGE);
pinfo->current_proto = saved_proto;
}
diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c
index 3410e63f89..131a603be3 100644
--- a/epan/dissectors/packet-mp2t.c
+++ b/epan/dissectors/packet-mp2t.c
@@ -271,9 +271,9 @@ get_docsis_packet_length(tvbuff_t * tvb, gint offset)
static void
mp2t_depi_docsis_fragmentation_handle(tvbuff_t *tvb, guint offset,
- packet_info *pinfo, proto_tree *tree,
- guint frag_offset, guint frag_len,
- gboolean fragment_last)
+ packet_info *pinfo, proto_tree *tree,
+ guint frag_offset, guint frag_len,
+ gboolean fragment_last)
{
fragment_data *frag_msg = 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) {
tvbuff_t *next_tvb = tvb_new_subset(tvb, offset, payload_len, payload_len);
const char *saved_proto = pinfo->current_proto;
+ void *pd_save = pinfo->private_data;
TRY {
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.
*/
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);
pinfo->current_proto = saved_proto;
}
diff --git a/epan/dissectors/packet-nbns.c b/epan/dissectors/packet-nbns.c
index 04e15724f3..033d754ba8 100644
--- a/epan/dissectors/packet-nbns.c
+++ b/epan/dissectors/packet-nbns.c
@@ -252,9 +252,9 @@ nbns_type_name (int type)
static proto_tree *
add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
- const char *name, int namelen,
- const char *type_name, const char *class_description,
- guint ttl, gushort data_len)
+ const char *name, int namelen,
+ const char *type_name, const char *class_description,
+ guint ttl, gushort data_len)
{
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
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;
const guchar *name;
@@ -369,8 +369,8 @@ bad:
static int
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,
- int *class_ret)
+ char *name_ret, int *name_len_ret, int *name_type_ret,
+ int *type_ret, int *class_ret)
{
int name_len;
int type;
@@ -394,7 +394,7 @@ get_nbns_name_type_class(tvbuff_t *tvb, int offset, int nbns_data_offset,
static void
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) {
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
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;
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, val_to_str(flags & F_RCODE, rcode_vals, "Unknown error"), MAX_BUF_SIZE);
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",
val_to_str(flags & F_RCODE, rcode_vals,
"Unknown error"));
@@ -544,7 +544,7 @@ nbns_add_nb_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset, gushort flags)
static void
nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset,
- gushort flags)
+ gushort flags)
{
char *buf;
proto_item *field_tree;
@@ -608,7 +608,7 @@ nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset,
static int
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;
char *name;
@@ -981,7 +981,7 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset,
static int
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;
proto_tree *qatree = NULL;
@@ -1007,8 +1007,8 @@ dissect_query_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
static int
dissect_answer_records(tvbuff_t *tvb, int cur_off, int nbns_data_offset,
- int count, column_info *cinfo, proto_tree *nbns_tree, int opcode,
- const char *name)
+ int count, column_info *cinfo, proto_tree *nbns_tree,
+ int opcode, const char *name)
{
int start_off, add_off;
proto_tree *qatree = NULL;
@@ -1246,11 +1246,9 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
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,
- "Unknown message type (0x%02X)"));
- }
+ "Unknown message type (0x%02X)"));
if (tree) {
ti = proto_tree_add_item(tree, proto_nbdgm, tvb, offset, -1,
@@ -1400,7 +1398,7 @@ static const value_string error_codes[] = {
*/
static int
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_item *ti = NULL;
@@ -1416,6 +1414,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
gint reported_len;
tvbuff_t *next_tvb;
const char *saved_proto;
+ void *pd_save;
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);
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);
@@ -1542,8 +1540,7 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
add_name_and_type(nbss_tree, tvb, offset, len,
"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;
@@ -1554,10 +1551,9 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
val_to_str(tvb_get_guint8(tvb, offset),
error_codes, "Unknown (%x)"));
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
- val_to_str(tvb_get_guint8(tvb, offset),
- error_codes, "Unknown (%x)"));
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
+ val_to_str(tvb_get_guint8(tvb, offset),
+ error_codes, "Unknown (%x)"));
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.
*/
saved_proto = pinfo->current_proto;
+ pd_save = pinfo->private_data;
TRY {
dissect_netbios_payload(next_tvb, pinfo, tree);
}
@@ -1610,6 +1607,11 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
RETHROW;
}
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);
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)"));
- }
while (tvb_reported_length_remaining(tvb, offset) > 0) {
len = dissect_nbss_packet(tvb, offset, pinfo, tree, is_cifs);
diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c
index 6997d7f467..602a17c97e 100644
--- a/epan/dissectors/packet-ntlmssp.c
+++ b/epan/dissectors/packet-ntlmssp.c
@@ -1746,9 +1746,8 @@ dissect_ntlmssp_auth (tvbuff_t *tvb, packet_info *pinfo, int offset,
data_start = MIN(data_start, item_start);
data_end = MAX(data_end, item_end);
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, ", User: %s\\%s",
- ntlmssph->domain_name, ntlmssph->acct_name);
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", User: %s\\%s",
+ ntlmssph->domain_name, ntlmssph->acct_name);
/* hostname */
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_signature_size = 8;
guint32 ntlm_seq_size = 4;
+ void *pd_save;
+
length = tvb_length (tvb);
/* signature + seq + real payload */
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
* exception.
*/
+ pd_save = pinfo->private_data;
TRY {
/* Version number */
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) {
RETHROW;
} 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);
} ENDTRY;
@@ -2107,6 +2114,7 @@ dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *volatile ntlmssp_tree = NULL;
proto_item *tf = NULL;
ntlmssp_header_t *ntlmssph;
+ void *pd_save;
ntlmssph=ep_alloc(sizeof(ntlmssp_header_t));
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
* exception.
*/
+ pd_save = pinfo->private_data;
TRY {
/* NTLMSSP constant */
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);
offset += 4;
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
- val_to_str(ntlmssph->type,
- ntlmssp_message_types,
- "Unknown message type"));
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
+ val_to_str(ntlmssph->type,
+ ntlmssp_message_types,
+ "Unknown message type"));
/* Call the appropriate dissector based on the Message Type */
switch (ntlmssph->type) {
@@ -2178,6 +2186,11 @@ dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} CATCH(BoundsError) {
RETHROW;
} 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);
} ENDTRY;
@@ -2365,6 +2378,8 @@ dissect_ntlmssp_payload_only(tvbuff_t *tvb, packet_info *pinfo, _U_ proto_tree *
volatile int offset = 0;
proto_tree *volatile ntlmssp_tree = NULL;
guint32 encrypted_block_length;
+ void *pd_save;
+
/* the magic ntlm is the identifier of a NTLMSSP packet that's 00 00 00 01
*/
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
* exception.
*/
+ pd_save = pinfo->private_data;
TRY {
/* Version number */
@@ -2403,6 +2419,11 @@ dissect_ntlmssp_payload_only(tvbuff_t *tvb, packet_info *pinfo, _U_ proto_tree *
} CATCH(BoundsError) {
RETHROW;
} 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);
} ENDTRY;
@@ -2420,6 +2441,7 @@ dissect_ntlmssp_verf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *tf = NULL;
guint32 verifier_length;
guint32 encrypted_block_length;
+ void *pd_save;
verifier_length = tvb_length (tvb);
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
* exception.
*/
+ pd_save = pinfo->private_data;
TRY {
/* Version number */
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) {
RETHROW;
} 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);
} ENDTRY;
diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c
index 2a1183d38f..9936546b5d 100644
--- a/epan/dissectors/packet-sflow.c
+++ b/epan/dissectors/packet-sflow.c
@@ -687,7 +687,7 @@ void proto_reg_handoff_sflow_245(void);
/* dissect a sampled header - layer 2 protocols */
static gint
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;
volatile guint32 header_length;
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. */
gboolean save_writable;
gboolean save_in_error_pkt;
- volatile address save_dl_src;
- volatile address save_dl_dst;
- volatile address save_net_src;
- volatile address save_net_dst;
- volatile address save_src;
- volatile address save_dst;
+ address save_dl_src;
+ address save_dl_dst;
+ address save_net_src;
+ address save_net_dst;
+ address save_src;
+ address save_dst;
+ void *pd_save;
version = tvb_get_ntohl(tvb, 0);
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_src = pinfo->src;
save_dst = pinfo->dst;
+ pd_save = pinfo->private_data;
TRY
{
@@ -825,7 +827,11 @@ dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo,
}
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;
@@ -2682,8 +2688,7 @@ dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
guint i = 0;
/* 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 */
@@ -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);
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);
offset += 4;
@@ -2702,15 +2706,13 @@ dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
switch (agent_addr_type) {
case ADDR_TYPE_IPV4:
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);
offset += 4;
break;
case ADDR_TYPE_IPV6:
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));
proto_tree_add_item(sflow_245_tree, hf_sflow_agent_address_v6, tvb, offset, 16, FALSE);
offset += 16;
@@ -2722,21 +2724,18 @@ dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (version == 5) {
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);
offset += 4;
}
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);
offset += 4;
proto_tree_add_item(sflow_245_tree, hf_sflow_245_sysuptime, tvb, offset, 4, FALSE);
offset += 4;
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);
offset += 4;
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 369ac52c8c..2e23509c56 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -1523,10 +1523,10 @@ static gboolean tcp_desegment = TRUE;
static void
desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
- guint32 seq, guint32 nxtseq,
- guint32 sport, guint32 dport,
- proto_tree *tree, proto_tree *tcp_tree,
- struct tcp_analysis *tcpd)
+ guint32 seq, guint32 nxtseq,
+ guint32 sport, guint32 dport,
+ proto_tree *tree, proto_tree *tcp_tree,
+ struct tcp_analysis *tcpd)
{
struct tcpinfo *tcpinfo = pinfo->private_data;
fragment_data *ipfd_head;
@@ -1956,9 +1956,9 @@ again:
*/
void
tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- gboolean proto_desegment, guint fixed_len,
- guint (*get_pdu_len)(packet_info *, tvbuff_t *, int),
- dissector_t dissect_pdu)
+ gboolean proto_desegment, guint fixed_len,
+ guint (*get_pdu_len)(packet_info *, tvbuff_t *, int),
+ dissector_t dissect_pdu)
{
volatile int offset = 0;
int offset_before;
@@ -1967,6 +1967,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint length;
tvbuff_t *next_tvb;
proto_item *item=NULL;
+ void *pd_save;
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
* see, so we just re-throw it.
*/
+ pd_save = pinfo->private_data;
TRY {
(*dissect_pdu)(next_tvb, pinfo, tree);
}
@@ -2100,6 +2102,11 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
RETHROW;
}
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);
}
ENDTRY;
diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c
index dc50124724..54bc972f6c 100644
--- a/epan/dissectors/packet-tds.c
+++ b/epan/dissectors/packet-tds.c
@@ -1728,6 +1728,7 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvbuff_t *volatile next_tvb;
proto_item *tds_item = NULL;
proto_tree *tds_tree = NULL;
+ void *pd_save;
while (tvb_reported_length_remaining(tvb, offset) != 0) {
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
* type.
*/
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_add_str(pinfo->cinfo, COL_INFO,
- val_to_str(type, packet_type_names,
- "Unknown Packet Type: %u"));
- }
+ col_add_str(pinfo->cinfo, COL_INFO,
+ val_to_str(type, packet_type_names,
+ "Unknown Packet Type: %u"));
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
* more to see, so we just re-throw it.
*/
+ pd_save = pinfo->private_data;
TRY {
dissect_netlib_buffer(next_tvb, pinfo, tree);
}
@@ -1863,6 +1863,12 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
RETHROW;
}
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);
}
ENDTRY;
diff --git a/epan/dissectors/packet-tpkt.c b/epan/dissectors/packet-tpkt.c
index d39f63bb05..7f6fa01d0b 100644
--- a/epan/dissectors/packet-tpkt.c
+++ b/epan/dissectors/packet-tpkt.c
@@ -203,7 +203,7 @@ int parseReservedText ( guint8* pTpktData )
*/
void
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_tree *tpkt_tree = NULL;
@@ -217,6 +217,8 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
tvbuff_t *volatile next_tvb;
const char *saved_proto;
guint8 string[4];
+ void *pd_save;
+
/*
* If we're reassembling segmented TPKT PDUs, empty the COL_INFO
* 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
* anyway.
*/
- if (tpkt_desegment && check_col(pinfo->cinfo, COL_INFO))
+ if (tpkt_desegment)
col_add_str(pinfo->cinfo, COL_INFO, "");
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;
* why the second?
*/
- if (!tpkt_desegment && !pinfo->fragmented
- && check_col(pinfo->cinfo, COL_INFO)) {
+ if (!tpkt_desegment && !pinfo->fragmented) {
col_add_fstr(pinfo->cinfo, COL_INFO,
"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
* more to see, so we just re-throw it.
*/
-
+ pd_save = pinfo->private_data;
TRY {
call_dissector(subdissector_handle, next_tvb, pinfo,
tree);
@@ -342,6 +343,12 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
RETHROW;
}
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);
}
ENDTRY;
@@ -358,7 +365,7 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
void
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_tree *tpkt_tree = NULL;
@@ -368,6 +375,7 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
volatile int length;
tvbuff_t *volatile next_tvb;
const char *saved_proto;
+ void *pd_save;
/*
* 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
* anyway.
*/
- if (desegment && check_col(pinfo->cinfo, COL_INFO))
+ if (desegment)
col_set_str(pinfo->cinfo, COL_INFO, "");
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;
* why the second?
*/
- if (!desegment && !pinfo->fragmented
- && check_col(pinfo->cinfo, COL_INFO)) {
+ if (!desegment && !pinfo->fragmented) {
col_add_fstr(pinfo->cinfo, COL_INFO,
"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
* more to see, so we just re-throw it.
*/
+ pd_save = pinfo->private_data;
TRY {
call_dissector(subdissector_handle, next_tvb, pinfo,
tree);
@@ -549,6 +557,12 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
RETHROW;
}
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);
}
ENDTRY;
@@ -644,7 +658,7 @@ proto_register_tpkt(void)
proto_register_field_array(proto_tpkt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("tpkt", dissect_tpkt, proto_tpkt);
-
+
tpkt_module = prefs_register_protocol(proto_tpkt, NULL);
prefs_register_bool_preference(tpkt_module, "desegment",
"Reassemble TPKT messages spanning multiple TCP segments",
@@ -665,10 +679,10 @@ proto_reg_handoff_tpkt(void)
x224_handle = find_dissector("x224");
tpkt_x224_handle = create_dissector_handle(dissect_tpkt_x224, proto_tpkt);
dissector_add("tcp.port", TCP_PORT_TPKT_X224, tpkt_x224_handle);
-
+
/*
tpkt_ascii_handle = create_dissector_handle(dissect_ascii_tpkt, proto_tpkt);
dissector_add("tcp.port", TCP_PORT_TPKT, tpkt_ascii_handle);
*/
-
+
}