aboutsummaryrefslogtreecommitdiff
path: root/libsylph/procheader.c
diff options
context:
space:
mode:
authorHiro <Hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-10 08:38:30 +0000
committerHiro <Hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-10 08:38:30 +0000
commit57940797b47f21c2a5f54b6d12abad9553e0e0f9 (patch)
tree191d890f991b4748202375f47ce8115744bde2de /libsylph/procheader.c
parentd19d2c5d8874b947abc80b7aa29c7b19909006f7 (diff)
fixed crashes on abnormal date.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@628 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/procheader.c')
-rw-r--r--libsylph/procheader.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libsylph/procheader.c b/libsylph/procheader.c
index 9267ead1..82a1d615 100644
--- a/libsylph/procheader.c
+++ b/libsylph/procheader.c
@@ -768,6 +768,12 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len)
t.tm_isdst = -1;
timer = mktime(&t);
+ if (timer == -1) {
+ if (dest)
+ dest[0] = '\0';
+ return 0;
+ }
+
tz_offset = remote_tzoffset_sec(zone);
if (tz_offset != -1)
timer += tzoffset_sec(&timer) - tz_offset;
@@ -787,6 +793,11 @@ void procheader_date_get_localtime(gchar *dest, gint len, const time_t timer)
Xalloca(tmp, len + 1, dest[0] = '\0'; return;);
lt = localtime(&timer);
+ if (!lt) {
+ g_warning("can't get localtime of %d\n", timer);
+ dest[0] = '\0';
+ return;
+ }
if (prefs_common.date_format)
strftime(tmp, len, prefs_common.date_format, lt);