From 41a9ba25cd810fb86ad0d6943bf2d5556d91b99e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 8 Nov 2013 21:33:42 -0500 Subject: remove O_NOFOLLOW from __map_file used for time zone file loading it's not clear why I originally wrote O_NOFOLLOW into this; I suspect the reason was with an aim of making the function more general for mapping partially or fully untrusted files provided by the user. however, the timezone code already precludes use of absolute or relative pathnames in suid/sgid programs, and disallows .. in pathnames which are relative to one of the system timezone locations, so there is no threat of opening a symlink which is not trusted by appropriate user. since some users may wish to put symbolic links in the zoneinfo directories to alias timezones, it seems preferable to allow this. --- src/time/__map_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/time/__map_file.c b/src/time/__map_file.c index b322f095..84ae839f 100644 --- a/src/time/__map_file.c +++ b/src/time/__map_file.c @@ -9,7 +9,7 @@ const char unsigned *__map_file(const char *pathname, size_t *size) { struct stat st; const unsigned char *map = MAP_FAILED; - int flags = O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK; + int flags = O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_NONBLOCK; int fd = __syscall(SYS_open, pathname, flags); if (fd < 0) return 0; if (!__syscall(SYS_fstat, fd, &st)) -- cgit v1.2.1