summaryrefslogtreecommitdiff
path: root/thunar
diff options
context:
space:
mode:
authorAlexander Schwinn <alexxcons@xfce.org>2021-12-19 23:51:51 +0100
committerAlexander Schwinn <alexxcons@xfce.org>2021-12-20 00:34:56 +0100
commit704010c61b533756adba9e282f4767739676e601 (patch)
treeb8ece077b222a5218e11cf33a602a042819d2ec0 /thunar
parent004e7478c9367794edff2e28b5e6239c3ec31d1f (diff)
downloadthunar-704010c61b533756adba9e282f4767739676e601.tar.gz
Use save way to copy a "struct tm" to prevent crash (Issue #700)
Diffstat (limited to 'thunar')
-rw-r--r--thunar/thunar-util.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/thunar/thunar-util.c b/thunar/thunar-util.c
index 8d29659c..809245b2 100644
--- a/thunar/thunar-util.c
+++ b/thunar/thunar-util.c
@@ -397,6 +397,7 @@ thunar_util_humanize_file_time (guint64 file_time,
const gchar *date_custom_style)
{
const gchar *date_format;
+ struct tm *temp_tfile;
struct tm tfile;
time_t ftime;
GDate dfile;
@@ -410,7 +411,10 @@ thunar_util_humanize_file_time (guint64 file_time,
ftime = (time_t) file_time;
/* take a copy of the local file time */
- tfile = *localtime (&ftime);
+ temp_tfile = localtime (&ftime);
+ if (temp_tfile == NULL)
+ return g_strdup (_("Unknown"));
+ memcpy (&tfile, temp_tfile, sizeof (tfile));
/* check which style to use to format the time */
if (date_style == THUNAR_DATE_STYLE_SIMPLE || date_style == THUNAR_DATE_STYLE_SHORT || date_style == THUNAR_DATE_STYLE_CUSTOM_SIMPLE)