Page MenuHomeFreeBSD

tzcode: Fix issues when TZ is an absolute path
ClosedPublic

Authored by des on Sep 26 2025, 5:57 PM.
Tags
None
Referenced Files
F151376305: D52753.id162890.diff
Tue, Apr 7, 11:52 PM
Unknown Object (File)
Tue, Apr 7, 9:32 AM
Unknown Object (File)
Mon, Apr 6, 7:48 PM
Unknown Object (File)
Mon, Apr 6, 2:12 PM
Unknown Object (File)
Sat, Apr 4, 11:49 AM
Unknown Object (File)
Tue, Mar 31, 6:39 PM
Unknown Object (File)
Mon, Mar 30, 12:18 PM
Unknown Object (File)
Sun, Mar 22, 11:31 PM
Subscribers

Details

Summary
  • If TZ starts with TZDIR, strip any additional slashes so relname does not end up looking like an absolute path. For instance, TZ=/usr/share/zoneinfo//UTC should result in UTC, not /UTC.
  • In the setugid case, we were incorrectly passing name rather than relname to fstatat().
  • Modify the tz_env and tz_env_setugid test cases to exercise both of these scenarios.
  • Also add test cases for invalid values of TZ, which I wrote earlier but forgot to include in a5f14e4f9069.

Reported by: Paul Eggert <eggert@cs.ucla.edu>
MFC after: 3 days
Fixes: 967a49a21a27 ("Update tzcode to 2025b")
Fixes: a5f14e4f9069 ("tzcode: Use -00 only for invalid time zones")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable