diff options
author | bp <bp@FreeBSD.org> | 1999-12-28 15:34:23 +0000 |
---|---|---|
committer | bp <bp@FreeBSD.org> | 1999-12-28 15:34:23 +0000 |
commit | 5f346bab48d27ee52d2e0fdd4d06d29baa316d73 (patch) | |
tree | dbf1769313c05e6ade56e72db5f9c919fd895408 /sys/fs/msdosfs/msdosfs_vnops.c | |
parent | 7b78445d14a1cb269afaf69f0d3184074ddc08f6 (diff) | |
download | FreeBSD-src-5f346bab48d27ee52d2e0fdd4d06d29baa316d73.zip FreeBSD-src-5f346bab48d27ee52d2e0fdd4d06d29baa316d73.tar.gz |
Fix an overflow in the msdosfs_read() function which exposed on the files
with size > 2GB.
PR: 15639
Submitted by: Tim Kientzle <kientzle@acm.org>
Reviewed by: phk
Diffstat (limited to 'sys/fs/msdosfs/msdosfs_vnops.c')
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vnops.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 3ef8e74..3ad5135 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -545,7 +545,7 @@ msdosfs_read(ap) } */ *ap; { int error = 0; - int diff; + off_t diff; int blsize; int isadir; int orig_resid; @@ -575,12 +575,12 @@ msdosfs_read(ap) isadir = dep->de_Attributes & ATTR_DIRECTORY; do { + if (uio->uio_offset >= dep->de_FileSize) + break; lbn = de_cluster(pmp, uio->uio_offset); on = uio->uio_offset & pmp->pm_crbomask; n = min((u_long) (pmp->pm_bpcluster - on), uio->uio_resid); diff = dep->de_FileSize - uio->uio_offset; - if (diff <= 0) - break; if (diff < n) n = diff; /* convert cluster # to block # if a directory */ |