From: matthew Date: Mon, 2 Aug 2010 02:03:21 +0000 (+0000) Subject: Fix readlink(2) on FFS and ext2 filesystems to consistently return X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1330d409f940b760c224d3420b641cd246358e8b;p=openbsd Fix readlink(2) on FFS and ext2 filesystems to consistently return EFAULT when appropriate. ok deraadt@, miod@ --- diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index 38e10ee63ca..a6f71915d49 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vnops.c,v 1.52 2009/08/13 15:00:14 jasper Exp $ */ +/* $OpenBSD: ext2fs_vnops.c,v 1.53 2010/08/02 02:03:22 matthew Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */ /* @@ -1115,8 +1115,8 @@ ext2fs_readlink(void *v) isize = ext2fs_size(ip); if (isize < vp->v_mount->mnt_maxsymlinklen || (vp->v_mount->mnt_maxsymlinklen == 0 && ip->i_e2fs_nblock == 0)) { - uiomove((char *)ip->i_e2din->e2di_shortlink, isize, ap->a_uio); - return (0); + return (uiomove((char *)ip->i_e2din->e2di_shortlink, isize, + ap->a_uio)); } return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred)); } diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index c16d2ab0136..5a98875f46c 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.91 2010/07/03 02:08:35 thib Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.92 2010/08/02 02:03:21 matthew Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1491,8 +1491,7 @@ ufs_readlink(void *v) isize = DIP(ip, size); if (isize < vp->v_mount->mnt_maxsymlinklen || (vp->v_mount->mnt_maxsymlinklen == 0 && DIP(ip, blocks) == 0)) { - uiomove((char *)SHORTLINK(ip), isize, ap->a_uio); - return (0); + return (uiomove((char *)SHORTLINK(ip), isize, ap->a_uio)); } return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred)); }