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
+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.
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 == '-')
{