forked from osmocom/wireshark
gif: expert info for unknown data block type
Before this patch, the dissector would assume that any data block type that is unknown must be the trailer byte. Check explicitly if we have a trailer byte and bring up an expert info for unknown data block types. Change-Id: I4c3087eb403e2e668a22628062edd0240309a2bc Reviewed-on: https://code.wireshark.org/review/21790 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
346d16d0fd
commit
c299afe0e3
|
@ -36,6 +36,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/expert.h>
|
||||
|
||||
#include <wsutil/str_util.h>
|
||||
|
||||
|
@ -288,6 +289,7 @@ static gint ett_local_flags = -1;
|
|||
static gint ett_extension = -1;
|
||||
static gint ett_image = -1;
|
||||
|
||||
static expert_field ei_gif_unknown_data_block_type = EI_INIT;
|
||||
|
||||
/****************** GIF protocol dissection functions ******************/
|
||||
|
||||
|
@ -559,11 +561,17 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
if (ret <= 0)
|
||||
break;
|
||||
offset += ret;
|
||||
} else {
|
||||
} else if (peek == 0x3B) { /* Trailer byte */
|
||||
/* GIF processing stops at this very byte */
|
||||
proto_tree_add_item(gif_tree, &hfi_trailer,
|
||||
tvb, offset, 1, ENC_NA);
|
||||
offset++;
|
||||
break;
|
||||
} else {
|
||||
proto_tree_add_expert(gif_tree, pinfo,
|
||||
&ei_gif_unknown_data_block_type,
|
||||
tvb, offset, 1);
|
||||
offset++;
|
||||
}
|
||||
proto_item_set_len(ti, offset-offset_start);
|
||||
} /* while */
|
||||
|
@ -652,8 +660,17 @@ proto_register_gif(void)
|
|||
&ett_image,
|
||||
};
|
||||
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_gif_unknown_data_block_type,
|
||||
{ "gif.data_block_type.unknown", PI_PROTOCOL, PI_WARN,
|
||||
"Unknown GIF data block type", EXPFILL }
|
||||
}
|
||||
};
|
||||
|
||||
int proto_gif;
|
||||
|
||||
expert_module_t* expert_gif;
|
||||
|
||||
/* Register the protocol name and description */
|
||||
proto_gif = proto_register_protocol(
|
||||
"Compuserve GIF",
|
||||
|
@ -667,6 +684,8 @@ proto_register_gif(void)
|
|||
* and subtrees used */
|
||||
proto_register_fields(proto_gif, hfi, array_length(hfi));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
expert_gif = expert_register_protocol(proto_gif);
|
||||
expert_register_field_array(expert_gif, ei, array_length(ei));
|
||||
|
||||
gif_handle = register_dissector(IMG_GIF, dissect_gif, proto_gif);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue