mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Linkat(2) should sanity check flags.
PiperOrigin-RevId: 224047765 Change-Id: I6f3c75b33c32bf8f8910ea3fab35406d7d672d87
This commit is contained in:
@@ -1251,6 +1251,12 @@ func Linkat(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal
|
||||
// AT_SYMLINK_FOLLOW can be specified in flags to cause oldpath to be
|
||||
// dereferenced if it is a symbolic link.
|
||||
flags := args[4].Int()
|
||||
|
||||
// Sanity check flags.
|
||||
if flags&^(linux.AT_SYMLINK_FOLLOW|linux.AT_EMPTY_PATH) != 0 {
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
resolve := flags&linux.AT_SYMLINK_FOLLOW == linux.AT_SYMLINK_FOLLOW
|
||||
allowEmpty := flags&linux.AT_EMPTY_PATH == linux.AT_EMPTY_PATH
|
||||
|
||||
|
||||
Reference in New Issue
Block a user