Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/sys/msdosfs Pull up revision 1.96 (requested by jdolecek):
details: https://anonhg.NetBSD.org/src/rev/2c596684497f
branches: netbsd-1-4
changeset: 470539:2c596684497f
user: he <he%NetBSD.org@localhost>
date: Sun Apr 30 13:13:03 2000 +0000
description:
Pull up revision 1.96 (requested by jdolecek):
Avoid integer overflow preventing reading of files >2GB in size.
Fixes PR#9046.
diffstat:
sys/msdosfs/msdosfs_vnops.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (34 lines):
diff -r 8a08c4216aa5 -r 2c596684497f sys/msdosfs/msdosfs_vnops.c
--- a/sys/msdosfs/msdosfs_vnops.c Sun Apr 30 13:11:22 2000 +0000
+++ b/sys/msdosfs/msdosfs_vnops.c Sun Apr 30 13:13:03 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_vnops.c,v 1.79.2.6 2000/02/04 23:00:17 he Exp $ */
+/* $NetBSD: msdosfs_vnops.c,v 1.79.2.7 2000/04/30 13:13:03 he Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -464,7 +464,7 @@
struct ucred *a_cred;
} */ *ap = v;
int error = 0;
- int diff;
+ int64_t diff;
int blsize;
int isadir;
long n;
@@ -490,11 +490,12 @@
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)
+ if (uio->uio_offset >= dep->de_FileSize)
return (0);
+ /* file size (and hence diff) may be up to 4GB */
+ diff = dep->de_FileSize - uio->uio_offset;
if (diff < n)
- n = diff;
+ n = (long) diff;
/* convert cluster # to block # if a directory */
if (isadir) {
error = pcbmap(dep, lbn, &lbn, 0, &blsize);
Home |
Main Index |
Thread Index |
Old Index