aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sip.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2007-08-08 14:25:17 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2007-08-08 14:25:17 +0000
commit193c1f42037566020e135dda555a22b2c637ccc5 (patch)
tree98616cc8930def9df4b82b0962ec92546b604fe9 /epan/dissectors/packet-sip.c
parente69908ae3ad92f7cb165b449a1eeb82081813439 (diff)
Wireshark fails to decode the MIME encapsulation part correctly if there is a
"white space" in the Content-Type field before the semi-colon. http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1716 Still does not work correctly as packet-multipart.c seems to have got broken. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22470 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-sip.c')
-rw-r--r--epan/dissectors/packet-sip.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index 9bc1f180e0..43c49e8649 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -703,6 +703,19 @@ static gint tvb_skip_wsp(tvbuff_t* tvb, gint offset, gint maxlength)
return (counter);
}
+static gint tvb_skip_wsp_return(tvbuff_t* tvb, gint offset){
+ gint counter = offset;
+ gint end;
+ guint8 tempchar;
+ end = 0;
+
+ for(counter = offset; counter > end &&
+ ((tempchar = tvb_get_guint8(tvb,counter)) == ' ' ||
+ tempchar == '\t' || tempchar == '\n' || tempchar == '\r'); counter--);
+ counter++;
+ return (counter);
+}
+
/* Structure to collect info about a sip uri */
typedef struct _uri_offset_info
{
@@ -2130,13 +2143,20 @@ separator_found2:
}
content_type_len = value_len;
semi_colon_offset = tvb_find_guint8(tvb, value_offset, value_len, ';');
+ /* Content-Type = ( "Content-Type" / "c" ) HCOLON media-type
+ * media-type = m-type SLASH m-subtype *(SEMI m-parameter)
+ * SEMI = SWS ";" SWS ; semicolon
+ * LWS = [*WSP CRLF] 1*WSP ; linear whitespace
+ * SWS = [LWS] ; sep whitespace
+ */
if ( semi_colon_offset != -1) {
+ gint content_type_end;
/*
* Skip whitespace after the semicolon.
*/
parameter_offset = tvb_skip_wsp(tvb, semi_colon_offset +1, value_offset + value_len - (semi_colon_offset +1));
-
- content_type_len = semi_colon_offset - value_offset;
+ content_type_end = tvb_skip_wsp_return(tvb, semi_colon_offset-1);
+ content_type_len = content_type_end - value_offset;
content_type_parameter_str_len = value_offset + value_len - parameter_offset;
content_type_parameter_str = tvb_get_ephemeral_string(tvb, parameter_offset,
content_type_parameter_str_len);
@@ -2148,6 +2168,9 @@ separator_found2:
#else
media_type_str_lower_case = g_ascii_strdown(media_type_str, -1);
#endif
+ /* Debug code
+ proto_tree_add_text(hdr_tree, tvb, value_offset,content_type_len,"media_type_str=%s",media_type_str);
+ */
break;
case POS_CONTENT_LENGTH :