1 --- localtime.c 2020-05-16 21:54:00.533111800 -0700
2 +++ localtime.c.patched 2020-05-22 00:03:30.826646000 -0700
6 /* TZDIR with a trailing '/' rather than a trailing '\0'. */
7 -static char const tzdirslash[sizeof TZDIR] = TZDIR "/";
8 +static char const tzdirslash[sizeof TZDIR + 1] = TZDIR "/";
10 /* Local storage needed for 'tzloadbody'. */
13 would pull in stdio (and would fail if the
14 resulting string length exceeded INT_MAX!). */
15 memcpy(lsp->fullname, tzdirslash, sizeof tzdirslash);
16 - strcpy(lsp->fullname + sizeof tzdirslash, name);
17 + strcpy(lsp->fullname + sizeof tzdirslash - 1, name);
19 /* Set doaccess if NAME contains a ".." file name
20 component, as such a name could read a file outside
24 if (doaccess && access(name, R_OK) != 0)
28 fid = open(name, OPEN_MODE);
32 nread = read(fid, up->buf, sizeof up->buf);
33 if (nread < (ssize_t)tzheadsize) {
34 int err = nread < 0 ? errno : EINVAL;
43 + base = strrchr(name, '/');
44 + base = base ? base + 1 : name;
45 + if (strcmp(base, TZDEFRULES))
47 + nread = sizeof _posixrules_data;
48 + memcpy(up->buf, _posixrules_data, nread);
50 for (stored = 4; stored <= 8; stored *= 2) {
51 int_fast32_t ttisstdcnt = detzcode(up->tzhead.tzh_ttisstdcnt);
52 int_fast32_t ttisutcnt = detzcode(up->tzhead.tzh_ttisutcnt);
54 tzsetlcl(char const *name)
56 struct state *sp = __lclptr;
58 + name = tzgetwintzi(__UNCONST(wildabbr), (char *) alloca (512));
59 int lcl = name ? strlen(name) < sizeof lcl_TZname : -1;
60 if (lcl < 0 ? lcl_is_set < 0
61 : 0 < lcl_is_set && strcmp(lcl_TZname, name) == 0)