summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2017-05-19 00:45:30 +0200
committerAnders Broman <a.broman58@gmail.com>2017-05-19 11:07:32 +0000
commite71219c711e80a5534a03ab03e1c412cd53c1998 (patch)
tree09f94b51ae73c5e5fe90a61ab2d82d7fc7f64157
parent2d46fc3a897df30c293d6f8b50037ae1e2e0e590 (diff)
downloadwireshark-e71219c711e80a5534a03ab03e1c412cd53c1998.tar.gz
SDP: Handle incomplete media attributes
Media attributes have a format of name:value, where, if the value is missing the colon is missing too. Sometimes the colon is there, while the value is missing. Even though this is in error, continue dissecting the other attributes. Bug: 13698 Change-Id: I369b6db657b33a368f4b12134412100774105615 Reviewed-on: https://code.wireshark.org/review/21699 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-sdp.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c
index c6c5c21575..44616d7e5b 100644
--- a/epan/dissectors/packet-sdp.c
+++ b/epan/dissectors/packet-sdp.c
@@ -1607,9 +1607,9 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
/* Attribute field name is token before ':' */
tokenlen = colon_offset - offset;
- proto_tree_add_item(sdp_media_attribute_tree,
- hf_media_attribute_field,
- tvb, offset, tokenlen, ENC_UTF_8|ENC_NA);
+ pi = proto_tree_add_item(sdp_media_attribute_tree,
+ hf_media_attribute_field,
+ tvb, offset, tokenlen, ENC_UTF_8|ENC_NA);
/*??field_name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tokenlen, ENC_ASCII);*/
sdp_media_attrbute_code = find_sdp_media_attribute_names(tvb, offset, tokenlen);
@@ -1619,9 +1619,13 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
offset = tvb_skip_wsp(tvb, offset, tvb_captured_length_remaining(tvb, offset));
/* Value is the remainder of the line */
- attribute_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_UTF_8|ENC_NA);
-
-
+ if (tvb_captured_length_remaining(tvb, offset) > 0)
+ attribute_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_UTF_8|ENC_NA);
+ else
+ {
+ expert_add_info(pinfo, pi, &ei_sdp_invalid_line_fields);
+ return;
+ }
/*********************************************/
/* Special parsing for some field name types */