diff options
author | Martin Pelikan <pelikan@cvs.openbsd.org> | 2014-07-11 14:30:53 +0000 |
---|---|---|
committer | Martin Pelikan <pelikan@cvs.openbsd.org> | 2014-07-11 14:30:53 +0000 |
commit | f5d4878b8056dfc7625a517d190e0a11f9893001 (patch) | |
tree | db311bbe30253adb19da4ee1ae70b1c6e9c93b78 /sys/ufs/ext2fs/ext2fs_readwrite.c | |
parent | d220318fcbc951056f5e1a3e018d295d580b5a45 (diff) |
determine and use maximum file size instead of magical constants
ok guenther
Diffstat (limited to 'sys/ufs/ext2fs/ext2fs_readwrite.c')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_readwrite.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c index e8029ac7ac2..118f9ce5961 100644 --- a/sys/ufs/ext2fs/ext2fs_readwrite.c +++ b/sys/ufs/ext2fs/ext2fs_readwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_readwrite.c,v 1.29 2014/05/09 03:48:58 tedu Exp $ */ +/* $OpenBSD: ext2fs_readwrite.c,v 1.30 2014/07/11 14:30:52 pelikan Exp $ */ /* $NetBSD: ext2fs_readwrite.c,v 1.16 2001/02/27 04:37:47 chs Exp $ */ /*- @@ -92,8 +92,7 @@ ext2fs_read(void *v) panic("%s: type %d", "ext2fs_read", vp->v_type); #endif fs = ip->i_e2fs; - if ((u_int64_t)uio->uio_offset > - ((u_int64_t)0x80000000 * fs->e2fs_bsize - 1)) + if (e2fs_overflow(fs, 0, uio->uio_offset)) return (EFBIG); if (uio->uio_resid == 0) return (0); @@ -203,9 +202,7 @@ ext2fs_write(void *v) } fs = ip->i_e2fs; - if (uio->uio_offset < 0 || - (u_int64_t)uio->uio_offset + uio->uio_resid > - ((u_int64_t)0x80000000 * fs->e2fs_bsize - 1)) + if (e2fs_overflow(fs, uio->uio_resid, uio->uio_offset + uio->uio_resid)) return (EFBIG); /* do the filesize rlimit check */ |