summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux/vfs2
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-14 01:03:39 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-14 01:03:39 +0000
commitcba632e025a0caaefe04d55d301f9f375b6eb3af (patch)
tree4d607e00e8a89f2f753dc776698291a15155ebe9 /pkg/sentry/syscalls/linux/vfs2
parenteeac3e792a0295a35a5d9c7eea4f89b59c887036 (diff)
parent71e6ac3e1f551cf52166bf501de114f06502b994 (diff)
Merge release-20200323.0-146-g71e6ac3 (automated)
Diffstat (limited to 'pkg/sentry/syscalls/linux/vfs2')
-rwxr-xr-xpkg/sentry/syscalls/linux/vfs2/read_write.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/syscalls/linux/vfs2/read_write.go b/pkg/sentry/syscalls/linux/vfs2/read_write.go
index 35f6308d6..898b190fd 100755
--- a/pkg/sentry/syscalls/linux/vfs2/read_write.go
+++ b/pkg/sentry/syscalls/linux/vfs2/read_write.go
@@ -130,8 +130,8 @@ func Pread64(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysca
}
defer file.DecRef()
- // Check that the offset is legitimate.
- if offset < 0 {
+ // Check that the offset is legitimate and does not overflow.
+ if offset < 0 || offset+int64(size) < 0 {
return 0, nil, syserror.EINVAL
}
@@ -362,8 +362,8 @@ func Pwrite64(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
}
defer file.DecRef()
- // Check that the offset is legitimate.
- if offset < 0 {
+ // Check that the offset is legitimate and does not overflow.
+ if offset < 0 || offset+int64(size) < 0 {
return 0, nil, syserror.EINVAL
}