From 8921bb17b56f25666e81fa4de63d35a14db8738b Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Tue, 15 Nov 2011 20:14:51 +0000 Subject: Check the return value of dissect_sip_name_addr_or_addr_spec() Should fix the recent fuzz failures. Thanks Chris for isolating the offending packet. svn path=/trunk/; revision=39867 --- epan/dissectors/packet-sip.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 720f7c3274..c06a6065c0 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -1481,12 +1481,13 @@ dissect_sip_contact_item(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi sip_uri_offset_init(&uri_offsets); /* contact-param = (name-addr / addr-spec) *(SEMI contact-params) */ current_offset = dissect_sip_name_addr_or_addr_spec(tvb, pinfo, start_offset, line_end_offset, &uri_offsets); - display_sip_uri(tvb, tree, &uri_offsets, &sip_contact_uri); if(current_offset == -1) { /* Parsing failed */ return -1; } + display_sip_uri(tvb, tree, &uri_offsets, &sip_contact_uri); + /* Check if we have contact parameters, the uri should be followed by a ';' */ contact_params_start_offset = tvb_find_guint8(tvb, uri_offsets.uri_end, line_end_offset - uri_offsets.uri_end, ';'); /* check if contact-params is present */ @@ -1700,6 +1701,8 @@ static void dissect_sip_route_header(tvbuff_t *tvb, proto_tree *tree, packet_inf if (c == ',') { sip_uri_offset_init(&uri_offsets); current_offset = dissect_sip_name_addr_or_addr_spec(tvb, pinfo, start_offset, current_offset, &uri_offsets); + if(current_offset == -1) + return; display_sip_uri(tvb, tree, &uri_offsets, sip_route_uri); current_offset++; @@ -1708,6 +1711,8 @@ static void dissect_sip_route_header(tvbuff_t *tvb, proto_tree *tree, packet_inf } else if (current_offset == line_end_offset - 1) { sip_uri_offset_init(&uri_offsets); current_offset = dissect_sip_name_addr_or_addr_spec(tvb, pinfo, start_offset, line_end_offset, &uri_offsets); + if(current_offset == -1) + return; display_sip_uri(tvb, tree, &uri_offsets, sip_route_uri); return; -- cgit v1.2.1