diff options
Diffstat (limited to 'epan/dissectors/file-rfc7468.c')
-rw-r--r-- | epan/dissectors/file-rfc7468.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/epan/dissectors/file-rfc7468.c b/epan/dissectors/file-rfc7468.c index ec01fabaf6..b3d6c811c7 100644 --- a/epan/dissectors/file-rfc7468.c +++ b/epan/dissectors/file-rfc7468.c @@ -11,21 +11,23 @@ #include "config.h" #include <epan/packet.h> +#include <wiretap/wtap.h> void proto_register_rfc7468(void); void proto_reg_handoff_rfc7468(void); -static int proto_rfc7468 = -1; +static int proto_rfc7468; -static gint ett_rfc7468 = -1; -static gint ett_rfc7468_preeb = -1; -static gint ett_rfc7468_data = -1; -static gint ett_rfc7468_posteb = -1; +static gint ett_rfc7468; +static gint ett_rfc7468_preeb; +static gint ett_rfc7468_data; +static gint ett_rfc7468_posteb; -static int hf_rfc7468_preeb_label = -1; -static int hf_rfc7468_ber_data = -1; -static int hf_rfc7468_posteb_label = -1; +static int hf_rfc7468_preeb_label; +static int hf_rfc7468_ber_data; +static int hf_rfc7468_posteb_label; +static dissector_handle_t rfc7468_handle = NULL; static dissector_handle_t ber_handle = NULL; static dissector_table_t rfc7468_label_table; @@ -132,10 +134,10 @@ dissect_rfc7468(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data { int offset; int linelen; - int next_offset; + int next_offset = 0; const guchar *line; - const guchar *labelp; - int labellen; + const guchar *labelp = NULL; + int labellen = 0; char *label; proto_tree *rfc7468_tree, *preeb_tree, *posteb_tree; proto_item *rfc7468_item, *ti; @@ -150,7 +152,7 @@ dissect_rfc7468(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data * First, process the text lines prior to the pre-encapsulation * boundary; they're explanatory text lines. */ - for (;;) { + while (tvb_offset_exists(tvb, offset)) { linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); if (linelen == -1) { /* No complete line was found. Nothing more to do. */ @@ -200,7 +202,7 @@ dissect_rfc7468(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data */ label = wmem_strndup(pinfo->pool, labelp, labellen); proto_tree_add_item(preeb_tree, hf_rfc7468_preeb_label, tvb, - offset + (int)preeb_prefix_len, labellen, ENC_ASCII|ENC_NA); + offset + (int)preeb_prefix_len, labellen, ENC_ASCII); col_add_fstr(pinfo->cinfo, COL_INFO, "Label: %s", label); @@ -212,7 +214,7 @@ dissect_rfc7468(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* * Skip over any blank lines before the base64 information. */ - for (;;) { + while (tvb_offset_exists(tvb, offset)) { linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); if (linelen == -1) { /* No complete line was found. We're done. */ @@ -257,7 +259,7 @@ dissect_rfc7468(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data gint base64_state = 0; guint base64_save = 0; guint datasize = 0; - for (;;) { + while (tvb_offset_exists(tvb, offset)) { linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); if (linelen == -1) { /* @@ -350,7 +352,7 @@ dissect_rfc7468(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data * Extract the label, and put it in that subtree. */ proto_tree_add_item(posteb_tree, hf_rfc7468_posteb_label, tvb, - offset + (int)posteb_prefix_len, labellen, ENC_ASCII|ENC_NA); + offset + (int)posteb_prefix_len, labellen, ENC_ASCII); return tvb_captured_length(tvb); } @@ -458,16 +460,15 @@ proto_register_rfc7468(void) rfc7468_label_table = register_dissector_table("rfc7468.preeb_label", "FFF", proto_rfc7468, FT_STRING, - TRUE); + STRING_CASE_INSENSITIVE); + + rfc7468_handle = register_dissector("rfc7468", dissect_rfc7468, proto_rfc7468); } void proto_reg_handoff_rfc7468(void) { - dissector_handle_t rfc7468_handle; - heur_dissector_add("wtap_file", dissect_rfc7468_heur, "RFC 7468 file", "rfc7468_wtap", proto_rfc7468, HEURISTIC_ENABLE); - rfc7468_handle = create_dissector_handle(dissect_rfc7468, proto_rfc7468); dissector_add_uint("wtap_encap", WTAP_ENCAP_RFC7468, rfc7468_handle); ber_handle = find_dissector("ber"); |