mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Verify that when offset address is not null, infile must be seekable
Change-Id: Id247399baeac58f6cd774acabd5d1da05e5b5697 PiperOrigin-RevId: 196887768
This commit is contained in:
committed by
Shentubot
parent
5b4c20e1b8
commit
3131a6b131
@@ -1915,6 +1915,10 @@ func Sendfile(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
|
||||
hasOffset := offsetAddr != 0
|
||||
// If we have a provided offset.
|
||||
if hasOffset {
|
||||
// Verify that when offset address is not null, infile must be seekable
|
||||
if !inFile.Flags().Pread {
|
||||
return 0, nil, syserror.ESPIPE
|
||||
}
|
||||
// Copy in the offset.
|
||||
if _, err := t.CopyIn(offsetAddr, &offset); err != nil {
|
||||
return 0, nil, err
|
||||
|
||||
Reference in New Issue
Block a user