fix: check gmtime, can return NULL on error - stagit-gopher - A git gopher frontend. (mirror) HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 28730218c4b68e9b3a0f7ce628868bb647d97f9e DIR parent 8df54926f2ad80ae46a4cc701f3341e97839e0c8 HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Wed, 27 Apr 2016 19:24:15 +0200 fix: check gmtime, can return NULL on error Diffstat: M stagit-index.c | 3 ++- M stagit.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- DIR diff --git a/stagit-index.c b/stagit-index.c @@ -49,7 +49,8 @@ printtimeformat(FILE *fp, const git_time *intime, const char *fmt) char out[32]; t = (time_t) intime->time + (intime->offset * 60); - intm = gmtime(&t); + if (!(intm = gmtime(&t))) + return; strftime(out, sizeof(out), fmt, intm); fputs(out, fp); } DIR diff --git a/stagit.c b/stagit.c @@ -190,7 +190,8 @@ printtimeformat(FILE *fp, const git_time *intime, const char *fmt) char out[32]; t = (time_t) intime->time + (intime->offset * 60); - intm = gmtime(&t); + if (!(intm = gmtime(&t))) + return; strftime(out, sizeof(out), fmt, intm); fputs(out, fp); }