webrtc, rtmp2: Fix parsing of userinfo in URI strings

While parsing the string, `gst_uri_from_string()` also unescapes the
userinfo. This is bad if your username contains a `:` character, since
we will then split the userinfo at the wrong location when parsing it.

To fix this, we can use the new `gst_uri_from_string_escaped()` API
that was added in
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/583

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/831

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1481>
This commit is contained in:
Nirbheek Chauhan 2020-08-01 02:12:21 +05:30
parent 962ebebe06
commit 827afa206d
2 changed files with 3 additions and 3 deletions

View file

@ -780,7 +780,7 @@ _clear_ice_stream (struct NiceStreamItem *item)
static GstUri *
_validate_turn_server (GstWebRTCICE * ice, const gchar * s)
{
GstUri *uri = gst_uri_from_string (s);
GstUri *uri = gst_uri_from_string_escaped (s);
const gchar *userinfo, *scheme;
GList *keys = NULL, *l;
gchar *user = NULL, *pass = NULL;
@ -855,7 +855,7 @@ out:
void
gst_webrtc_ice_set_stun_server (GstWebRTCICE * ice, const gchar * uri_s)
{
GstUri *uri = gst_uri_from_string (uri_s);
GstUri *uri = gst_uri_from_string_escaped (uri_s);
const gchar *msg = "must be of the form stun://<host>:<port>";
GST_DEBUG_OBJECT (ice, "setting stun server, %s", uri_s);

View file

@ -165,7 +165,7 @@ uri_handler_set_uri (GstURIHandler * handler, const gchar * string,
{
gchar *string_without_path = g_strndup (string, path_sep - string);
uri = gst_uri_from_string (string_without_path);
uri = gst_uri_from_string_escaped (string_without_path);
g_free (string_without_path);
}