From: Derrick Brashear Date: Mon, 13 Feb 2006 18:39:11 +0000 (+0000) Subject: STABLE14-solaris-afs-nfsrdwr-avoid-reading-past-end-of-file-20060213 X-Git-Tag: openafs-stable-1_4_1-rc7~6 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1a7229dbbc96e06beeb8461e8e554e561c2668e6;p=packages%2Fo%2Fopenafs.git STABLE14-solaris-afs-nfsrdwr-avoid-reading-past-end-of-file-20060213 FIXES 25747 avoid a panic when we attempt a read past the end of the file (cherry picked from commit 63031c0b8b1a00711a043431cb5d1c98834ab0cc) --- diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index 028148b49..fae5817ba 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -895,8 +895,9 @@ afs_nfsrdwr(avc, auio, arw, ioflag, acred) * call it with an offset based on blocks smaller than MAXBSIZE * (implying that it should be named BSIZE, since it is clearly both a * max and a min). */ - size = auio->afsio_resid; /* transfer size */ - fileBase = auio->afsio_offset; /* start file position for xfr */ + size = auio->afsio_resid; /* transfer size */ + fileBase = ((arw == UIO_READ) && (origLength < auio->uio_offset)) ? + origLength : auio->afsio_offset; /* start file position for xfr */ pageBase = fileBase & ~(MAXBSIZE - 1); /* file position of the page */ pageOffset = fileBase & (MAXBSIZE - 1); /* xfr start's offset within page */ tsize = MAXBSIZE - pageOffset; /* how much more fits in this page */