diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-04-21 23:36:34 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-21 23:36:34 +0000 |
commit | 9e983d691225db47475f4447899e7421864b9b6c (patch) | |
tree | 7fe8779aa43d31d1c6199f5e44458eb1d8a425a7 /pkg/sentry/syscalls/linux/vfs2 | |
parent | 306c14cdd4e68b95703e78c3877b627d4f7d7885 (diff) | |
parent | 37e01fd2ea6a0e67637975863317be9aae1b02f0 (diff) |
Merge release-20200323.0-207-g37e01fd (automated)
Diffstat (limited to 'pkg/sentry/syscalls/linux/vfs2')
-rwxr-xr-x | pkg/sentry/syscalls/linux/vfs2/getdents.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/sentry/syscalls/linux/vfs2/getdents.go b/pkg/sentry/syscalls/linux/vfs2/getdents.go index 62e98817d..c7c7bf7ce 100755 --- a/pkg/sentry/syscalls/linux/vfs2/getdents.go +++ b/pkg/sentry/syscalls/linux/vfs2/getdents.go @@ -130,7 +130,7 @@ func (cb *getdentsCallback) Handle(dirent vfs.Dirent) error { if cb.t.Arch().Width() != 8 { panic(fmt.Sprintf("unsupported sizeof(unsigned long): %d", cb.t.Arch().Width())) } - size := 8 + 8 + 2 + 1 + 1 + 1 + len(dirent.Name) + size := 8 + 8 + 2 + 1 + 1 + len(dirent.Name) size = (size + 7) &^ 7 // round up to multiple of sizeof(long) if size > cb.remaining { return syserror.EINVAL @@ -143,11 +143,11 @@ func (cb *getdentsCallback) Handle(dirent vfs.Dirent) error { // Zero out all remaining bytes in buf, including the NUL terminator // after dirent.Name and the zero padding byte between the name and // dirent type. - bufTail := buf[18+len(dirent.Name):] + bufTail := buf[18+len(dirent.Name) : size-1] for i := range bufTail { bufTail[i] = 0 } - bufTail[2] = dirent.Type + buf[size-1] = dirent.Type } n, err := cb.t.CopyOutBytes(cb.addr, buf) if err != nil { |