aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-08-12 14:07:24 +0200
committerStig Bjørlykke <stig@bjorlykke.org>2015-08-12 12:09:43 +0000
commitdc7443fcc9fe499a8e2c9f0cd09cf85e89b22beb (patch)
tree228c0c8da89a4683e8936ff43cf29e5eb595d0e0 /epan/proto.c
parenta3e3d603101cbf6fe4d2ece2c0ae1ae999a0a30f (diff)
Added guards for deregistered fields
This is functions used when redissecting after a Lua plugins reload. Change-Id: Ida14526faec1992006938a6732ee894ac83c2d12 Reviewed-on: https://code.wireshark.org/review/9995 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 28c9ff792a..0658342509 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -656,6 +656,13 @@ free_GPtrArray_value(gpointer key, gpointer value, gpointer user_data _U_)
gint hfid = GPOINTER_TO_UINT(key);
header_field_info *hfinfo;
+ g_ptr_array_free(ptrs, TRUE);
+
+ if (gpa_hfinfo.hfi[hfid] == NULL) {
+ /* This is a deregistered field */
+ return;
+ }
+
PROTO_REGISTRAR_GET_NTH(hfid, hfinfo);
if (hfinfo->ref_type != HF_REF_TYPE_NONE) {
/* when a field is referenced by a filter this also
@@ -669,8 +676,6 @@ free_GPtrArray_value(gpointer key, gpointer value, gpointer user_data _U_)
}
hfinfo->ref_type = HF_REF_TYPE_NONE;
}
-
- g_ptr_array_free(ptrs, TRUE);
}
static void
@@ -5501,6 +5506,10 @@ proto_get_frame_protocols(const wmem_list_t *layers, gboolean *is_ip,
while (protos != NULL)
{
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
+ if (gpa_hfinfo.hfi[proto_id] == NULL) {
+ protos = wmem_list_frame_next(protos);
+ continue; /* This is a deregistered protocol */
+ }
proto_name = proto_get_protocol_filter_name(proto_id);
if (is_ip && ((!strcmp(proto_name, "ip")) ||
@@ -5535,6 +5544,10 @@ proto_is_frame_protocol(const wmem_list_t *layers, const char* proto_name)
while (protos != NULL)
{
proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos));
+ if (gpa_hfinfo.hfi[proto_id] == NULL) {
+ protos = wmem_list_frame_next(protos);
+ continue; /* This is a deregistered protocol */
+ }
name = proto_get_protocol_filter_name(proto_id);
if (!strcmp(name, proto_name))