mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
rtsp: fix resolving of hostnames
We were returning a pointer to a stack variable with the resolved hostname, which doesn't work. return a copy of the resolved ip address instead. Fixes #575256.
This commit is contained in:
parent
e863e4ed1b
commit
f4b7cbbf16
1 changed files with 7 additions and 5 deletions
|
@ -386,7 +386,7 @@ accept_failed:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
static gchar *
|
||||||
do_resolve (const gchar * host)
|
do_resolve (const gchar * host)
|
||||||
{
|
{
|
||||||
struct hostent *hostinfo;
|
struct hostent *hostinfo;
|
||||||
|
@ -421,7 +421,7 @@ do_resolve (const gchar * host)
|
||||||
sizeof (ipbuf));
|
sizeof (ipbuf));
|
||||||
#endif /* G_OS_WIN32 */
|
#endif /* G_OS_WIN32 */
|
||||||
}
|
}
|
||||||
return ip;
|
return g_strdup (ip);
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
not_resolved:
|
not_resolved:
|
||||||
|
@ -535,7 +535,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout)
|
||||||
guint idx, line;
|
guint idx, line;
|
||||||
gint retval;
|
gint retval;
|
||||||
GstClockTime to;
|
GstClockTime to;
|
||||||
const gchar *ip;
|
gchar *ip;
|
||||||
guint16 port;
|
guint16 port;
|
||||||
gchar codestr[4], *resultstr;
|
gchar codestr[4], *resultstr;
|
||||||
gint code;
|
gint code;
|
||||||
|
@ -649,6 +649,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout)
|
||||||
|
|
||||||
/* connect to the host/port */
|
/* connect to the host/port */
|
||||||
res = do_connect (ip, port, &conn->fd1, conn->fdset, timeout);
|
res = do_connect (ip, port, &conn->fd1, conn->fdset, timeout);
|
||||||
|
g_free (ip);
|
||||||
if (res != GST_RTSP_OK)
|
if (res != GST_RTSP_OK)
|
||||||
goto connect_failed;
|
goto connect_failed;
|
||||||
|
|
||||||
|
@ -738,7 +739,7 @@ GstRTSPResult
|
||||||
gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout)
|
gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout)
|
||||||
{
|
{
|
||||||
GstRTSPResult res;
|
GstRTSPResult res;
|
||||||
const gchar *ip;
|
gchar *ip;
|
||||||
guint16 port;
|
guint16 port;
|
||||||
GstRTSPUrl *url;
|
GstRTSPUrl *url;
|
||||||
|
|
||||||
|
@ -760,7 +761,7 @@ gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout)
|
||||||
goto connect_failed;
|
goto connect_failed;
|
||||||
|
|
||||||
g_free (conn->ip);
|
g_free (conn->ip);
|
||||||
conn->ip = g_strdup (ip);
|
conn->ip = ip;
|
||||||
|
|
||||||
/* this is our read URL */
|
/* this is our read URL */
|
||||||
conn->readfd = &conn->fd0;
|
conn->readfd = &conn->fd0;
|
||||||
|
@ -783,6 +784,7 @@ not_resolved:
|
||||||
connect_failed:
|
connect_failed:
|
||||||
{
|
{
|
||||||
GST_ERROR ("failed to connect");
|
GST_ERROR ("failed to connect");
|
||||||
|
g_free (ip);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
tunneling_failed:
|
tunneling_failed:
|
||||||
|
|
Loading…
Reference in a new issue