From 077b45e033a5dce78ddea7d8c4f6dd7772b68d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Mon, 1 Dec 2014 15:13:25 +0100 Subject: [PATCH] imf: Added base64 content encoding support Change-Id: I668b9c3dfcac83c698e83d4111af8bd19ec8076c Reviewed-on: https://code.wireshark.org/review/5559 Reviewed-by: Michael Mann --- epan/dissectors/packet-imf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index b8c044101d..ae2fe7f8ad 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -680,6 +680,7 @@ dissect_imf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *item; proto_tree *unknown_tree, *text_tree; char *content_type_str = NULL; + char *content_encoding_str = NULL; char *parameters = NULL; int hf_id; gint start_offset = 0; @@ -786,6 +787,8 @@ dissect_imf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_imf_content_type(tvb, start_offset, end_offset - start_offset, item, &content_type_str, ¶meters); + } else if (hf_id == hf_imf_content_transfer_encoding) { + content_encoding_str = tvb_get_string_enc (wmem_packet_scope(), tvb, value_offset, end_offset - value_offset - 2, ENC_ASCII); } else if(f_info->subdissector) { /* we have a subdissector */ @@ -806,7 +809,15 @@ dissect_imf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* now dissect the MIME based upon the content type */ if(content_type_str && media_type_dissector_table) { - next_tvb = tvb_new_subset_remaining(tvb, end_offset); + col_set_fence(pinfo->cinfo, COL_INFO); + + if(content_encoding_str && !g_ascii_strncasecmp(content_encoding_str, "base64", 6)) { + char *data = tvb_get_string_enc(wmem_packet_scope(), tvb, end_offset, tvb_reported_length(tvb), ENC_ASCII); + next_tvb = base64_to_tvb(tvb, data); + add_new_data_source(pinfo, next_tvb, content_encoding_str); + } else { + next_tvb = tvb_new_subset_remaining(tvb, end_offset); + } dissector_try_string(media_type_dissector_table, content_type_str, next_tvb, pinfo, tree, parameters); } else {