authorgravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2020-11-17 14:05:01+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-30 18:08:27-07:00
logbeb9d33d6da42be75faed2975cf16e4acbf62be4
tree0b65bcec7d0ecb451ced0149dafae010254ac785
parent8c9919ec7b409d11ca73ca5764f44282dec0fe25

Disallow absolute paths passed as system libraries

Added OBJECT_NAME_INVALID handling in faccessatW

2 files changed, 4 insertions(+), 0 deletions(-)

lib/std/os.zig+1
......@@ -3809,6 +3809,7 @@ pub fn faccessatW(dirfd: fd_t, sub_path_w: [*:0]const u16, mode: u32, flags: u32
38093809 .SUCCESS => return,
38103810 .OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
38113811 .OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
3812 .OBJECT_NAME_INVALID => return error.BadPathName,
38123813 .INVALID_PARAMETER => unreachable,
38133814 .ACCESS_DENIED => return error.PermissionDenied,
38143815 .OBJECT_PATH_SYNTAX_BAD => unreachable,
src/main.zig+3
......@@ -1401,6 +1401,9 @@ fn buildOutputType(
14011401 _ = system_libs.orderedRemove(i);
14021402 continue;
14031403 }
1404 if (std.fs.path.isAbsolute(lib_name)) {
1405 fatal("cannot use absolute path as a system library: {}", .{lib_name});
1406 }
14041407 i += 1;
14051408 }
14061409 }