mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
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:
parent
0d2de69db9
commit
586fe4ea4b
1 changed files with 11 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue