diff options
author | Niels Provos <provos@cvs.openbsd.org> | 2000-06-18 06:26:13 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 2000-06-18 06:26:13 +0000 |
commit | 8f1072169ecefa9766fcc475b6a0aa0d0b0454cf (patch) | |
tree | b39b9bb572389c0d5e553fde8ff91c8f2d01a288 /sys/miscfs/tcfs/tcfs_rw.c | |
parent | 82e9b50a5bf52ea5b38386dcb38e8313248ce627 (diff) |
fix off by one error in loop, prevent that odd lengths get passed to
decryption function.
Diffstat (limited to 'sys/miscfs/tcfs/tcfs_rw.c')
-rw-r--r-- | sys/miscfs/tcfs/tcfs_rw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/miscfs/tcfs/tcfs_rw.c b/sys/miscfs/tcfs/tcfs_rw.c index 3bf31787b4a..906854ab916 100644 --- a/sys/miscfs/tcfs/tcfs_rw.c +++ b/sys/miscfs/tcfs/tcfs_rw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcfs_rw.c,v 1.3 2000/06/17 20:25:55 provos Exp $ */ +/* $OpenBSD: tcfs_rw.c,v 1.4 2000/06/18 06:26:12 provos Exp $ */ /* * Copyright 2000 The TCFS Project at http://tcfs.dia.unisa.it/ * All rights reserved. @@ -491,7 +491,6 @@ tcfs_ed(struct vnode *v, struct proc *p, struct ucred *c, tcfs_fileinfo *i) mp = MOUNTTOTCFSMOUNT(v->v_mount); encr = FI_CFLAG(i) || FI_GSHAR(i); - if (v->v_type != VREG) return (0); @@ -512,16 +511,17 @@ tcfs_ed(struct vnode *v, struct proc *p, struct ucred *c, tcfs_fileinfo *i) size = FI_ENDOF(i); - if(encr) { + if (encr) { + resid = size; w_size = D_PFOFF(size); sp = D_SPURE(size); } else { - w_size=size-FI_SPURE(i); + resid = D_PFOFF(size); + w_size= size - FI_SPURE(i); sp = -FI_SPURE(i); } csize = 0; - resid = size; w_resid = w_size; bufsize = BLOCKSIZE; @@ -543,7 +543,7 @@ tcfs_ed(struct vnode *v, struct proc *p, struct ucred *c, tcfs_fileinfo *i) wa.a_uio = ra.a_uio = u; - for(e = 0; e <= D_NOBLK(size); e++) { + for (e = 0; e < D_NOBLK(size); e++) { int x, y; u->uio_offset = csize; |