diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-11-27 11:48:35 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-11-27 11:48:35 +0100 |
commit | 41b5ef1e4cc6a28bd7274a016d83c95a93656248 (patch) | |
tree | a3df43ccbe1498745e84c6ccdc4f8db20e153f02 /src/gui | |
parent | 8ba8e625800462b060bc9e0cfc73dd05059c1f59 (diff) | |
download | weechat-41b5ef1e4cc6a28bd7274a016d83c95a93656248.zip |
core: check pointer returned by function localtime
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-chat.c | 2 | ||||
-rw-r--r-- | src/gui/gui-window.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 25b4922f5..d64f9ff65 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -337,6 +337,8 @@ gui_chat_get_time_string (time_t date) return NULL; local_time = localtime (&date); + if (!local_time) + return NULL; if (strftime (text_time, sizeof (text_time), CONFIG_STRING(config_look_buffer_time_format), local_time) == 0) diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index c14b8840d..43af20895 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -1113,7 +1113,8 @@ gui_window_scroll (struct t_gui_window *window, char *scroll) { old_date = ptr_line->data->date; date_tmp = localtime (&old_date); - memcpy (&old_line_date, date_tmp, sizeof (struct tm)); + if (date_tmp) + memcpy (&old_line_date, date_tmp, sizeof (struct tm)); } while (ptr_line) @@ -1134,7 +1135,8 @@ gui_window_scroll (struct t_gui_window *window, char *scroll) else { date_tmp = localtime (&(ptr_line->data->date)); - memcpy (&line_date, date_tmp, sizeof (struct tm)); + if (date_tmp) + memcpy (&line_date, date_tmp, sizeof (struct tm)); if (old_date > ptr_line->data->date) diff_date = old_date - ptr_line->data->date; else |