Thank you for reporting that bug with garbage data. I found another one while looking into that one, as the code didn't check that the entire tzfile header was read, which meant it could inspect garbage in the header. If I understand the errno-related fixes correctly they're trying to report detailed error values about various problems in parsing the TZ value as a POSIX string. However, the general tzcode philosophy is to prefer the new TZ interpretation first (i.e., read from an installed file somewhere), and to fall back on the POSIX interpretation only of the new interpretation does not work. If both the new and the POSIX interpretations fail, the new interpretation's errno value should suffice, which means there's no need to compute errno values when doing the POSIX interpretation. I'm attaching a proposed patch along those lines. This should also fix the abovementioned bugs. Plus, it gets rid of some related gotos.