rtsp-client: Drop trailing \0 of RTSP DATA messages

We add a trailing \0 in GstRTSPConnection to make parsing of
string message bodies easier (e.g. the SDP from DESCRIBE) but
for actual data this means we have to drop it or otherwise
create invalid data.
This commit is contained in:
Sebastian Dröge 2015-01-16 20:04:01 +01:00
parent 0d2de69db9
commit 586fe4ea4b

View file

@ -2601,9 +2601,14 @@ handle_data (GstRTSPClient * client, GstRTSPMessage * message)
if (res != GST_RTSP_OK)
return;
gst_rtsp_message_get_body (message, &data, &size);
if (size < 2)
goto invalid_length;
gst_rtsp_message_steal_body (message, &data, &size);
buffer = gst_buffer_new_wrapped (data, size);
/* Strip trailing \0 */
buffer = gst_buffer_new_wrapped (data, size - 1);
trans =
g_hash_table_lookup (priv->transports, GINT_TO_POINTER ((gint) channel));
@ -2613,6 +2618,11 @@ handle_data (GstRTSPClient * client, GstRTSPMessage * message)
} else {
gst_buffer_unref (buffer);
}
invalid_length:
{
GST_DEBUG ("client %p: Short message received, ignoring", client);
return;
}
}
/**