mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 15:46:17 +01:00
Don't try to parse dates that start with anything but a digit, a plus or a
2007-12-13 Bastien Nocera <hadess@hadess.net> * glib/gtimer.c: (g_time_val_from_iso8601): Don't try to parse dates that start with anything but a digit, a plus or a minus sign, as those can't be valid ISO8601 dates (Closes: #503029) svn path=/trunk/; revision=6111
This commit is contained in:
parent
85d370fb9b
commit
7bebca1f2e
@ -1,3 +1,10 @@
|
||||
2007-12-13 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* glib/gtimer.c: (g_time_val_from_iso8601):
|
||||
Don't try to parse dates that start with anything but a
|
||||
digit, a plus or a minus sign, as those can't be valid
|
||||
ISO8601 dates (Closes: #503029)
|
||||
|
||||
2007-12-13 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gkeyfile.c (g_key_file_clear): Free group_hash.
|
||||
|
@ -307,6 +307,16 @@ g_time_val_from_iso8601 (const gchar *iso_date,
|
||||
g_return_val_if_fail (iso_date != NULL, FALSE);
|
||||
g_return_val_if_fail (time_ != NULL, FALSE);
|
||||
|
||||
/* Ensure that the first character is a digit,
|
||||
* the first digit of the date, otherwise we don't
|
||||
* have an ISO 8601 date */
|
||||
while (g_ascii_isspace (*iso_date))
|
||||
iso_date++;
|
||||
if (*iso_date == '\0')
|
||||
return FALSE;
|
||||
if (!g_ascii_isdigit (*iso_date) || iso_date != '-' || *iso_date != '+')
|
||||
return FALSE;
|
||||
|
||||
val = strtoul (iso_date, (char **)&iso_date, 10);
|
||||
if (*iso_date == '-')
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user