From 827afa206d8c9675f2a7af402396552c2ed1df09 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 1 Aug 2020 02:12:21 +0530 Subject: [PATCH] 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: --- ext/webrtc/gstwebrtcice.c | 4 ++-- gst/rtmp2/gstrtmp2locationhandler.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/webrtc/gstwebrtcice.c b/ext/webrtc/gstwebrtcice.c index 9a9630d..9b2cc66 100644 --- a/ext/webrtc/gstwebrtcice.c +++ b/ext/webrtc/gstwebrtcice.c @@ -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://:"; GST_DEBUG_OBJECT (ice, "setting stun server, %s", uri_s); diff --git a/gst/rtmp2/gstrtmp2locationhandler.c b/gst/rtmp2/gstrtmp2locationhandler.c index 49c83bd..7c79c79 100644 --- a/gst/rtmp2/gstrtmp2locationhandler.c +++ b/gst/rtmp2/gstrtmp2locationhandler.c @@ -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); } -- 2.7.4