diff options
author | Bill Meier <wmeier@newsguy.com> | 2014-06-30 01:48:16 -0400 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-06-30 12:29:06 +0000 |
commit | 13221904228eedc6d75455433fb7beb77ab30cba (patch) | |
tree | 77d2ecf59ee8e9e44107cfa0112fd3b1095e99e6 | |
parent | 1d08bee488d73d8afb1a8ffc620eb72525ccb940 (diff) | |
download | wireshark-13221904228eedc6d75455433fb7beb77ab30cba.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>
(cherry picked from commit 9cf40b67b258616c248569b74685693f14a0aab3)
Reviewed-on: https://code.wireshark.org/review/2715
-rw-r--r-- | epan/proto.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c index f3f803ffaa..6c552ca1b4 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -4913,6 +4913,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) { @@ -4921,7 +4928,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); } @@ -4929,14 +4936,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); } |