summaryrefslogtreecommitdiff
path: root/libdiskfs/io-seek.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/io-seek.c')
-rw-r--r--libdiskfs/io-seek.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libdiskfs/io-seek.c b/libdiskfs/io-seek.c
index 9e3ff093..0018a712 100644
--- a/libdiskfs/io-seek.c
+++ b/libdiskfs/io-seek.c
@@ -46,6 +46,14 @@ diskfs_S_io_seek (struct protid *cred,
offset += np->dn_stat.st_size;
case SEEK_SET:
check:
+ /* pager_memcpy inherently uses vm_offset_t, which may be smaller than
+ off_t. */
+ if (sizeof(off_t) > sizeof(vm_offset_t) &&
+ offset > ((off_t) 1) << (sizeof(vm_offset_t) * 8))
+ {
+ err = EFBIG;
+ break;
+ }
if (offset >= 0)
{
*newoffset = cred->po->filepointer = offset;