summaryrefslogtreecommitdiff
path: root/libdiskfs/io-read.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-02-12 17:19:48 +0000
committerMiles Bader <miles@gnu.org>1997-02-12 17:19:48 +0000
commitd165827f4d2de2649eaaa2efe7413faaba4dd38f (patch)
tree09ad38db3bcab929e4a21293103d9b28d0745ef6 /libdiskfs/io-read.c
parent02d7a565d974d9d85e37a5592fa33dae7bd783ff (diff)
(diskfs_S_io_read):
Check OFF for validity and return EINVAL if it's bogus.
Diffstat (limited to 'libdiskfs/io-read.c')
-rw-r--r--libdiskfs/io-read.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libdiskfs/io-read.c b/libdiskfs/io-read.c
index a5dd148a..78ccf064 100644
--- a/libdiskfs/io-read.c
+++ b/libdiskfs/io-read.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -46,6 +46,11 @@ diskfs_S_io_read (struct protid *cred,
if (off == -1)
off = cred->po->filepointer;
+ if (off < 0)
+ {
+ mutex_unlock (&np->lock);
+ return EINVAL;
+ }
if (off > np->dn_stat.st_size)
maxread = 0;