From 3d04d468fce628bd5a9794269e0f2201431120aa Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Fri, 11 Nov 1994 18:11:32 +0000 Subject: (diskfs_S_io_read): If OFF is past the end of the file, don't set MAXREAD to a negative number; that will crash rdwr_internal. --- libdiskfs/io-read.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libdiskfs') diff --git a/libdiskfs/io-read.c b/libdiskfs/io-read.c index 59c2b793..b1cca454 100644 --- a/libdiskfs/io-read.c +++ b/libdiskfs/io-read.c @@ -48,9 +48,13 @@ diskfs_S_io_read (struct protid *cred, if (off == -1) off = cred->po->filepointer; - + if (off + maxread > np->dn_stat.st_size) - maxread = np->dn_stat.st_size - off; + { + maxread = np->dn_stat.st_size - off; + if (maxread < 0) + maxread = 0; + } if (maxread > *datalen) { -- cgit v1.2.3