ref: b843da74b79d585a30bd2b3f13e7c63d105baf94
parent: 7e3a98c60416721729db2b8ed87c722e30e85fda
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon May 16 06:42:43 EDT 2022
libc: Initialize internal fields in gmtime() Gmtime() converst a time_t date into a breakdown struct tm based in GMT timezone. Struct tm has a few internal fields that are used in some other time.h functions, like for example strftime, and they were not initialized by gmtime() producing random segfaults at execution time.
--- a/src/libc/time/gmtime.c
+++ b/src/libc/time/gmtime.c
@@ -32,6 +32,8 @@
tm.tm_mday = day + 1;
tm.tm_isdst = 0;
+ tm.tm_zone = "GMT";
+ tm.tm_gmtoff = 0;
return &tm;
}