[Commits] [SCM] claws branch, master, updated. 3.14.1-240-g029174b
ticho at claws-mail.org
ticho at claws-mail.org
Mon Mar 20 19:53:49 CET 2017
The branch, master has been updated
via 029174b069ccd7aeb2456fc97d2f6b6bf6a64108 (commit)
from 9fb2bb2b594d74ba82ff2c1c59c4a90283e29e23 (commit)
Summary of changes:
src/procheader.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 029174b069ccd7aeb2456fc97d2f6b6bf6a64108
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Mon Mar 20 19:52:11 2017 +0100
Fix crash on e-mails with invalid date on Windows.
This fixes crashing on dates with out of range numbers,
e.g. "Sun, 19 Mar 2017 27:41:31 +0600".
diff --git a/src/procheader.c b/src/procheader.c
index efa3a7f..ea20c93 100644
--- a/src/procheader.c
+++ b/src/procheader.c
@@ -1057,15 +1057,23 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len)
#ifdef G_OS_WIN32
GTimeZone *tz;
- GDateTime *dt;
+ GDateTime *dt, *dt2;
+ /* First create a valid GDateTime in UTC. */
+ tz = g_time_zone_new_utc();
+ dt = g_date_time_new(tz, 1, 1, 1, 0, 0, 0);
+ g_time_zone_unref(tz);
+ dt2 = g_date_time_add_full(dt, year-1, dmonth-1, day-1, hh, mm, ss);
+ g_date_time_unref(dt);
+
+ /* Now we shift it to the desired time zone. */
tz = g_time_zone_new(zone);
- dt = g_date_time_new(tz, year, dmonth, day, hh, mm, ss);
+ dt = g_date_time_to_timezone(dt2, tz);
+ g_date_time_unref(dt2);
+ g_time_zone_unref(tz);
timer = g_date_time_to_unix(dt);
-
g_date_time_unref(dt);
- g_time_zone_unref(tz);
#else
struct tm t;
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list