summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2014-06-30 01:48:16 -0400
committerEvan Huus <eapache@gmail.com>2014-06-30 12:28:12 +0000
commit9cf40b67b258616c248569b74685693f14a0aab3 (patch)
treee9df9b21963b5e15f0782d66b2559895327a8e2c /epan
parent01c9ac8d61e0697cc2d4e0419285d50182ca845c (diff)
downloadwireshark-9cf40b67b258616c248569b74685693f14a0aab3.tar.gz
Fix Bug #10238: Display filter expression dialog items do not expand/display properly.
Unfortunately, certain proto_hier_tree_model.c functions assume/require that a cookie generated by proto_(first|next)_protocol_field() will never have a NULL value. Bug introduced in gd47ae54. Change-Id: I42763d02f700e15ca9b3ab9980943d4f8d933ca9 Reviewed-on: https://code.wireshark.org/review/2712 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/proto.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c
index cabc70b155..05d7c9f119 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -4943,6 +4943,13 @@ proto_get_next_protocol(void **cookie)
return protocol->proto_id;
}
+/* XXX: Unfortunately certain functions in proto_hier_tree_model.c
+ assume that the cookie stored by
+ proto_get_(first|next)_protocol_field() will never have a
+ value of NULL. So, to preserve this semantic, the cookie value
+ below is adjusted so that the cookie value stored is 1 + the
+ current (zero-based) array index.
+*/
header_field_info *
proto_get_first_protocol_field(const int proto_id, void **cookie)
{
@@ -4951,7 +4958,7 @@ proto_get_first_protocol_field(const int proto_id, void **cookie)
if ((protocol == NULL) || (protocol->fields->len == 0))
return NULL;
- *cookie = GINT_TO_POINTER(0);
+ *cookie = GUINT_TO_POINTER(0 + 1);
return (header_field_info *)g_ptr_array_index(protocol->fields, 0);
}
@@ -4959,14 +4966,14 @@ header_field_info *
proto_get_next_protocol_field(const int proto_id, void **cookie)
{
protocol_t *protocol = find_protocol_by_id(proto_id);
- guint i = GPOINTER_TO_INT(*cookie);
+ guint i = GPOINTER_TO_UINT(*cookie) - 1;
i++;
if (i >= protocol->fields->len)
return NULL;
- *cookie = GINT_TO_POINTER(i);
+ *cookie = GUINT_TO_POINTER(i + 1);
return (header_field_info *)g_ptr_array_index(protocol->fields, i);
}