diff options
-rw-r--r-- | sys/msdosfs/denode.h | 5 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_vnops.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/msdosfs/denode.h b/sys/msdosfs/denode.h index 14b7ccbab0d..827433ac702 100644 --- a/sys/msdosfs/denode.h +++ b/sys/msdosfs/denode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: denode.h,v 1.17 2004/05/14 04:05:05 tedu Exp $ */ +/* $OpenBSD: denode.h,v 1.18 2005/03/01 14:24:33 tom Exp $ */ /* $NetBSD: denode.h,v 1.24 1997/10/17 11:23:39 ws Exp $ */ /*- @@ -178,6 +178,9 @@ struct denode { */ #define WIN_MAXLEN 255 +/* Maximum size of a file on a FAT filesystem */ +#define MSDOSFS_FILESIZE_MAX 0xFFFFFFFFLL + /* * Transfer directory entries between internal and external form. * dep is a struct denode * (internal form), diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index 44572722268..9fa6dad1c6a 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.49 2004/11/30 12:39:43 pedro Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.50 2005/03/01 14:24:33 tom Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -551,6 +551,10 @@ msdosfs_write(v) if (uio->uio_resid == 0) return (0); + /* Don't bother to try to write files larger than the f/s limit */ + if (uio->uio_offset + uio->uio_resid > MSDOSFS_FILESIZE_MAX) + return (EFBIG); + /* * If they've exceeded their filesize limit, tell them about it. */ |