diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-11-18 17:12:34 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-11-18 17:12:34 +0000 |
commit | 2af21da64dff5c7b4eb730e295f3e81ae97667d4 (patch) | |
tree | 8b12e9960ef439b2990b7648a7023a9b9005a669 /sys | |
parent | 3939abe9d5c0b96842845b1c60a475263a5d54fa (diff) |
Better and simpler check for negative offset; from Christer Oberg
Diffstat (limited to 'sys')
-rw-r--r-- | sys/miscfs/kernfs/kernfs_vnops.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c index cc7cf3080fb..86a33926edf 100644 --- a/sys/miscfs/kernfs/kernfs_vnops.c +++ b/sys/miscfs/kernfs/kernfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kernfs_vnops.c,v 1.41 2004/09/01 21:06:17 millert Exp $ */ +/* $OpenBSD: kernfs_vnops.c,v 1.42 2004/11/18 17:12:33 millert Exp $ */ /* $NetBSD: kernfs_vnops.c,v 1.43 1996/03/16 23:52:47 christos Exp $ */ /* @@ -696,6 +696,8 @@ kernfs_read(v) printf("kern_read %s\n", kt->kt_name); #endif + if (uio->uio_offset < 0) + return (EINVAL); off = uio->uio_offset; #if 0 while (buf = strbuf, @@ -705,8 +707,6 @@ kernfs_read(v) len = kernfs_xread(kt, off, &buf, sizeof(strbuf))) { if ((error = uiomove(buf, len, uio)) != 0) return (error); - if (off <= INT_MAX - len) - off += len; /* XXX - should use quad */ } return (0); } |