mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
session: use full charset for RTSP session ID
As specified in RFC 2326 section 3.4 use full valid charset to make guessing session ID more difficult. https://bugzilla.gnome.org/show_bug.cgi?id=643812
This commit is contained in:
parent
63744dfece
commit
17ce0df09a
1 changed files with 11 additions and 1 deletions
|
@ -30,6 +30,14 @@ enum
|
|||
PROP_LAST
|
||||
};
|
||||
|
||||
static const gchar session_id_charset[] =
|
||||
{ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
|
||||
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', '$', '-', '_', '.', '+'
|
||||
};
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (rtsp_session_debug);
|
||||
#define GST_CAT_DEFAULT rtsp_session_debug
|
||||
|
||||
|
@ -235,7 +243,9 @@ create_session_id (GstRTSPSessionPool * pool)
|
|||
gint i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
id[i] = g_random_int_range ('a', 'z');
|
||||
id[i] =
|
||||
session_id_charset[g_random_int_range (0,
|
||||
G_N_ELEMENTS (session_id_charset))];
|
||||
}
|
||||
|
||||
return g_strndup (id, 16);
|
||||
|
|
Loading…
Reference in a new issue