From db7f1ad2ad6d7c9b47d8643ba9d5447220b73d5b Mon Sep 17 00:00:00 2001 From: enami Date: Sat, 11 Oct 1997 00:05:15 +0000 Subject: [PATCH] Check read permission of symbolic link in vfs layer, when doing readlink(2). Suggested by der Mouse. Ok'ed by Jason R. Thorpe. --- sys/kern/vfs_syscalls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 62a84c2de948..8e73d96c8597 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.101 1997/10/10 02:09:30 fvdl Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.102 1997/10/11 00:05:15 enami Exp $ */ /* * Copyright (c) 1989, 1993 @@ -1364,7 +1364,7 @@ sys_readlink(p, v, retval) vp = nd.ni_vp; if (vp->v_type != VLNK) error = EINVAL; - else { + else if ((error = VOP_ACCESS(vp, VREAD, p->p_ucred, p)) == 0) { aiov.iov_base = SCARG(uap, buf); aiov.iov_len = SCARG(uap, count); auio.uio_iov = &aiov;