Module Name:    src
Committed By:   martin
Date:           Mon Nov 19 15:01:17 UTC 2012

Modified Files:
        src/sys/kern: vfs_syscalls.c

Log Message:
Use copyout to copy data from kernel out to userland!
Fixes PR kern/47217.


To generate a diff of this commit:
cvs rdiff -u -r1.460 -r1.461 src/sys/kern/vfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.460 src/sys/kern/vfs_syscalls.c:1.461
--- src/sys/kern/vfs_syscalls.c:1.460	Sun Nov 18 17:41:53 2012
+++ src/sys/kern/vfs_syscalls.c	Mon Nov 19 15:01:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.460 2012/11/18 17:41:53 manu Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.461 2012/11/19 15:01:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.460 2012/11/18 17:41:53 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.461 2012/11/19 15:01:17 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -3115,14 +3115,19 @@ sys_fstatat(struct lwp *l, const struct 
 		syscallarg(int) flag;
 	} */
 	unsigned int nd_flag;
+	struct stat sb;
+	int error;
 
 	if (SCARG(uap, flag) & AT_SYMLINK_NOFOLLOW)
 		nd_flag = NOFOLLOW;
 	else
 		nd_flag = FOLLOW;
 
-	return do_sys_statat(l, SCARG(uap, fd), SCARG(uap, path), nd_flag, 
-	    SCARG(uap, buf));
+	error = do_sys_statat(l, SCARG(uap, fd), SCARG(uap, path), nd_flag, 
+	    &sb);
+	if (error)
+		return error;
+	return copyout(&sb, SCARG(uap, buf), sizeof(sb));
 }
 
 /*

Reply via email to