Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/puffs Prevent access beyond end of PUFFS file on read,



details:   https://anonhg.NetBSD.org/src/rev/de20071f4aff
branches:  trunk
changeset: 778106:de20071f4aff
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Mar 16 23:13:48 2012 +0000

description:
Prevent access beyond end of PUFFS file on read,
similar to as is done for NFS.

diffstat:

 sys/fs/puffs/puffs_vnops.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 2e716f8aceb5 -r de20071f4aff sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Fri Mar 16 11:44:54 2012 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Fri Mar 16 23:13:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.163 2012/01/17 09:30:16 martin Exp $ */
+/*     $NetBSD: puffs_vnops.c,v 1.164 2012/03/16 23:13:48 jakllsch Exp $       */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.163 2012/01/17 09:30:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.164 2012/03/16 23:13:48 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -1862,6 +1862,9 @@
                const int advice = IO_ADV_DECODE(ap->a_ioflag);
 
                while (uio->uio_resid > 0) {
+                       if (vp->v_size <= uio->uio_offset) {
+                               break;
+                       }
                        bytelen = MIN(uio->uio_resid,
                            vp->v_size - uio->uio_offset);
                        if (bytelen == 0)



Home | Main Index | Thread Index | Old Index