diff options
author | Anders Broman <anders.broman@ericsson.com> | 2010-06-11 11:49:01 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2010-06-11 11:49:01 +0000 |
commit | 326ec92f7c26c136dad1e51d9f587623c99a4139 (patch) | |
tree | dd318c7d5c40f60141439848f6a8cdf4e416a8ae | |
parent | db4a00b4e49acdf4a6b6136ea84722e75bde0135 (diff) |
Fix: Malformed packet if port is missing from path.
svn path=/trunk/; revision=33209
-rw-r--r-- | epan/dissectors/packet-sdp.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 9e936f4568..0c933f8194 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -1686,17 +1686,19 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto /* Port is after next ':' */ port_offset = tvb_find_guint8(tvb, address_offset, -1, ':'); - - /* Port ends with '/' */ - port_end_offset = tvb_find_guint8(tvb, port_offset, -1, '/'); - - /* Attempt to convert address */ - if (inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, address_offset, port_offset-address_offset), &msrp_ipaddr) > 0) { - /* Get port number */ - msrp_port_number = atoi((char*)tvb_get_ephemeral_string(tvb, port_offset+1, port_end_offset-port_offset-1)); - /* Set flag so this info can be used */ - msrp_transport_address_set = TRUE; - } + /* Check if port is present if not skipp */ + if(port_offset!=-1){ + /* Port ends with '/' */ + port_end_offset = tvb_find_guint8(tvb, port_offset, -1, '/'); + + /* Attempt to convert address */ + if (inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, address_offset, port_offset-address_offset), &msrp_ipaddr) > 0) { + /* Get port number */ + msrp_port_number = atoi((char*)tvb_get_ephemeral_string(tvb, port_offset+1, port_end_offset-port_offset-1)); + /* Set flag so this info can be used */ + msrp_transport_address_set = TRUE; + } + } } break; case SDP_H248_ITEM: |