]> git.armaanb.net Git - stagit.git/commitdiff
fix: check gmtime, can return NULL on error
authorHiltjo Posthuma <hiltjo@codemadness.org>
Wed, 27 Apr 2016 17:24:15 +0000 (19:24 +0200)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Wed, 27 Apr 2016 17:24:15 +0000 (19:24 +0200)
stagit-index.c
stagit.c

index e2cac598910bf687a314ba14e38d66d452e02b34..5875d21960a25f393f8b765d22fae83454c7ba75 100644 (file)
@@ -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);
 }
index cbb0a7790e2851885ca9833b2c929a7763414c8b..e4e4cfeddd0968e8222a66fa6b0777e7826ed9cc 100644 (file)
--- 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);
 }