Disallow absolute paths passed as system libraries

Added OBJECT_NAME_INVALID handling in faccessatW
This commit is contained in:
Alexandros Naskos 2020-11-17 14:05:01 +02:00 committed by Andrew Kelley
parent 8c9919ec7b
commit beb9d33d6d
2 changed files with 4 additions and 0 deletions

View File

@ -3809,6 +3809,7 @@ pub fn faccessatW(dirfd: fd_t, sub_path_w: [*:0]const u16, mode: u32, flags: u32
.SUCCESS => return,
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
.OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
.OBJECT_NAME_INVALID => return error.BadPathName,
.INVALID_PARAMETER => unreachable,
.ACCESS_DENIED => return error.PermissionDenied,
.OBJECT_PATH_SYNTAX_BAD => unreachable,

View File

@ -1401,6 +1401,9 @@ fn buildOutputType(
_ = system_libs.orderedRemove(i);
continue;
}
if (std.fs.path.isAbsolute(lib_name)) {
fatal("cannot use absolute path as a system library: {}", .{lib_name});
}
i += 1;
}
}