From 5aab494dd63e6cbbbb54fa0e362ae64e85dcadb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 22 Sep 2017 21:50:01 +0200 Subject: core, plugins: check return code of strftime function --- src/plugins/trigger/trigger-callback.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/trigger') diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c index 79b2955a9..6dfcc4e0f 100644 --- a/src/plugins/trigger/trigger-callback.c +++ b/src/plugins/trigger/trigger-callback.c @@ -798,7 +798,9 @@ trigger_callback_print_cb (const void *pointer, void *data, date_tmp = localtime (&date); if (date_tmp) { - strftime (str_temp, sizeof (str_temp), "%Y-%m-%d %H:%M:%S", date_tmp); + if (strftime (str_temp, sizeof (str_temp), + "%Y-%m-%d %H:%M:%S", date_tmp) == 0) + str_temp[0] = '\0'; weechat_hashtable_set (extra_vars, "tg_date", str_temp); } snprintf (str_temp, sizeof (str_temp), "%d", displayed); @@ -940,7 +942,9 @@ trigger_callback_timer_cb (const void *pointer, void *data, date_tmp = localtime (&date); if (date_tmp) { - strftime (str_temp, sizeof (str_temp), "%Y-%m-%d %H:%M:%S", date_tmp); + if (strftime (str_temp, sizeof (str_temp), + "%Y-%m-%d %H:%M:%S", date_tmp) == 0) + str_temp[0] = '\0'; weechat_hashtable_set (extra_vars, "tg_date", str_temp); } -- cgit v1.2.3