flvdemux: fix date parsing when there are trailing spaces

Fixes parsing of "Thu May 11 15:57:46 2006 ".

https://bugzilla.gnome.org/show_bug.cgi?id=767496
This commit is contained in:
Tim-Philipp Müller 2016-06-10 13:42:01 +01:00
parent b4a4fa19a1
commit c51831a245

View file

@ -255,13 +255,17 @@ parse_flv_demux_parse_date_string (const gchar * s)
GstDateTime *dt = NULL;
gchar **tokens;
guint64 d;
gchar *endptr;
gchar *endptr, *stripped;
gint i, hh, mm, ss;
gint year = -1, month = -1, day = -1;
gint hour = -1, minute = -1, seconds = -1;
stripped = g_strstrip (g_strdup (s));
/* "Fri Oct 15 15:13:16 2004" needs to be parsed */
tokens = g_strsplit (s, " ", -1);
tokens = g_strsplit (stripped, " ", -1);
g_free (stripped);
if (g_strv_length (tokens) != 5)
goto out;