rtsp-media: Don't crash on encrypted RTX SDP

In parse_keymgmt(), don't mutate the input string that's been passed
as const, especially since we might need the original value again if
the same key info applies to multiple streams (RTX, for example).

https://bugzilla.gnome.org/show_bug.cgi?id=754753
This commit is contained in:
Jan Schmidt 2015-09-04 11:23:43 +10:00
parent 22b618836e
commit 315c2f93bb

View file

@ -3356,7 +3356,6 @@ static gboolean
parse_keymgmt (const gchar * keymgmt, GstCaps * caps) parse_keymgmt (const gchar * keymgmt, GstCaps * caps)
{ {
gboolean res = FALSE; gboolean res = FALSE;
gchar *p, *kmpid;
gsize size; gsize size;
guchar *data; guchar *data;
GstMIKEYMessage *msg; GstMIKEYMessage *msg;
@ -3364,17 +3363,28 @@ parse_keymgmt (const gchar * keymgmt, GstCaps * caps)
const gchar *srtp_cipher; const gchar *srtp_cipher;
const gchar *srtp_auth; const gchar *srtp_auth;
p = (gchar *) keymgmt; {
gchar *orig_value;
gchar *p, *kmpid;
p = orig_value = g_strdup (keymgmt);
SKIP_SPACES (p); SKIP_SPACES (p);
if (*p == '\0') if (*p == '\0') {
g_free (orig_value);
return FALSE; return FALSE;
}
PARSE_STRING (p, " ", kmpid); PARSE_STRING (p, " ", kmpid);
if (!g_str_equal (kmpid, "mikey")) if (kmpid == NULL || !g_str_equal (kmpid, "mikey")) {
g_free (orig_value);
return FALSE; return FALSE;
}
data = g_base64_decode (p, &size); data = g_base64_decode (p, &size);
g_free (orig_value); /* Don't need this any more */
}
if (data == NULL) if (data == NULL)
return FALSE; return FALSE;