提交 f6162949 编写于 作者: R Rich Felker

use default timezone from /etc/localtime if $TZ is unset/blank

the way this is implemented, it also allows explicit setting of
TZ=/etc/localtime even for suid programs. this is not a problem
because /etc/localtime is a trusted path, much like the trusted
zoneinfo search path.
上级 3ff3a1d5
......@@ -128,7 +128,7 @@ static void do_tzset()
"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
s = getenv("TZ");
if (!s || !*s) s = __gmt;
if (!s || !*s) s = "/etc/localtime";
if (old_tz && !strcmp(s, old_tz)) return;
......@@ -153,7 +153,8 @@ static void do_tzset()
if (*s == ':' || ((p=strchr(s, '/')) && !memchr(s, ',', p-s))) {
if (*s == ':') s++;
if (*s == '/' || *s == '.') {
if (!libc.secure) map = __map_file(s, &map_size);
if (!libc.secure || !strcmp(s, "/etc/localtime"))
map = __map_file(s, &map_size);
} else {
size_t l = strlen(s);
if (l <= NAME_MAX && !strchr(s, '.')) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册